Changes between Version 64 and Version 65 of Video_Users_Guide

Dec 15, 2016 7:08:33 AM (3 years ago)



  • Video_Users_Guide

    v64 v65  
    279279pjsua_vid_dev_set_setting(dev_id, PJMEDIA_VID_DEV_CAP_ORIENTATION, &new_orientation, PJ_TRUE) 
    280280 }}} 
    281  to set the video device to the correct orientation. 
     281 or PJSUA2 API 
     282 {{{ 
     283Endpoint.instance().vidDevManager().setCaptureOrient(dev_id, new_orient, true) 
     284 }}} 
     285 to tell the video device about the new orientation. 
    283287For sample usage, please refer to our sample apps, ipjsua for iOS, and pjsua2 for Android. Ticket #1861 explains this feature in detail. 
     289==== When video orientation signaling is available ==== 
     291In case application has the capability to signal remote about video orientation (e.g: via SIP INFO or RTP header extension), instead of telling video device capturer (via {{{pjsua_vid_dev_set_setting()}}} or {{{setCaptureOrient()}}}), it may signal remote directly about the new orientation. This way the video sent to remote will always in full frame (no black bands in left+right sides due to forcing landscape video in portrait frame or vice versa), but it may not be in "proper" orientation, this should not be problem though as remote could get the orientation info from out of band signaling, so it should be able to render the incoming video frames in "proper" orientation. 
     293However note that if '''portrait''' mode is prefered as the initial orientation in a video call session (default settings are set for landscape video orientation), the encoding part of video codec param should be configured as portrait too, i.e: width < height, e.g: 
     295/* Sending 240 x 320 */ 
     296param.enc_fmt.det.vid.size.w = 240; 
     297param.enc_fmt.det.vid.size.h = 320; 
     299and the initial video device orientation should be set as portrait too, e.g: 
     301/* After the capturer device is opened, e.g: using pjsua_vid_preview_start() 
     302 * or opened automatically by video call, tell the capture device about 
     303 * current orientation. Note this need to be done once only, so when orientation 
     304 * is changed, never update the device about the new orientation. 
     305 */ 
     307/* On Android, portrait mode is defined as PJMEDIA_ORIENT_ROTATE_270DEG */ 
     308current_orient = PJMEDIA_ORIENT_ROTATE_270DEG; 
     310/* On iOS, portrait mode is defined as PJMEDIA_ORIENT_ROTATE_90DEG*/ 
     311current_orient = PJMEDIA_ORIENT_ROTATE_90DEG; 
     313pjsua_vid_dev_set_setting(dev_id, PJMEDIA_VID_DEV_CAP_ORIENTATION, &current_orient, PJ_TRUE); 
     316then when device orientation is changed, application '''must not''' update the video device orientation, instead, it should just signal remote about device orientation. Updating orientation info to video capture device will cause device to rotate (and perhaps downsize the image) to make sure that the image always has 'proper' orientation (head upside).