From 97c47c4e1e14582218162e7cb8ed5185bd441357 Mon Sep 17 00:00:00 2001 From: Liong Sauw Ming Date: Fri, 21 Aug 2015 06:46:32 +0000 Subject: Fixed #1880: Incorrect orientation after switching video capture or when using back camera Included in this fix: * Change the spec & doc of pjmedia_orient enumeration * Change iOS sample app to rotate all video devices upon orientation change event. * Set orientation as well when fast switching cameras (for iOS and Android) git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@5166 74dad513-b988-da41-8d7b-12977e46ad98 --- pjsip-apps/src/pjsua/ios/ipjsua/ipjsuaAppDelegate.m | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'pjsip-apps') diff --git a/pjsip-apps/src/pjsua/ios/ipjsua/ipjsuaAppDelegate.m b/pjsip-apps/src/pjsua/ios/ipjsua/ipjsuaAppDelegate.m index 18d3557e..d85aba45 100644 --- a/pjsip-apps/src/pjsua/ios/ipjsua/ipjsuaAppDelegate.m +++ b/pjsip-apps/src/pjsua/ios/ipjsua/ipjsuaAppDelegate.m @@ -180,6 +180,7 @@ static void pjsuaOnAppConfigCb(pjsua_app_config *cfg) static pj_thread_t *a_thread; static UIDeviceOrientation prev_ori = 0; UIDeviceOrientation dev_ori = [[UIDevice currentDevice] orientation]; + int i; if (dev_ori == prev_ori) return; @@ -192,9 +193,15 @@ static void pjsuaOnAppConfigCb(pjsua_app_config *cfg) pj_thread_register("ipjsua", a_thread_desc, &a_thread); } - pjsua_vid_dev_set_setting(PJMEDIA_VID_DEFAULT_CAPTURE_DEV, - PJMEDIA_VID_DEV_CAP_ORIENTATION, - &pj_ori[dev_ori-1], PJ_TRUE); + /* Here we set the orientation for all video devices. + * This may return failure for renderer devices or for + * capture devices which do not support orientation setting, + * we can simply ignore them. + */ + for (i = pjsua_vid_dev_count()-1; i >= 0; i--) { + pjsua_vid_dev_set_setting(i, PJMEDIA_VID_DEV_CAP_ORIENTATION, + &pj_ori[dev_ori-1], PJ_TRUE); + } } #endif } -- cgit v1.2.3