Changes between Version 87 and Version 88 of Getting-Started/iPhone


Ignore:
Timestamp:
Jun 15, 2016 2:25:51 AM (3 years ago)
Author:
ming
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Getting-Started/iPhone

    v87 v88  
    6060 * for more info, run {{{./configure-iphone --help}}} 
    6161 * other customizations are similar to what is explained in [wiki:Getting-Started/Autoconf Building with GNU] page. 
     62 
     63=== Supporting multiple architectures (armv6, armv7, armv7s, arm64, and so on) === 
     64 
     65You need to compile separately for each architecture. If your iPhone SDK has '''{{{llvm-gcc}}}''' compiler (which is the supported compiler starting iOS SDK 5) or '''{{{clang}}}''', then you need to set '''{{{ARCH}}}''' environment variable to the desired architecture before running {{{configure-iphone}}}, for example: 
     66{{{ 
     67export ARCH="-arch arm64" 
     68}}} 
     69 
     70Then you need to combine the resulting libraries using the '''{{{lipo}}}''' command. For example: 
     71 
     72{{{ 
     73lipo -arch armv6 lib/armv6/libpjlib.a -arch armv7 lib/armv7/libpjlib.a -create -output lib/libpjlib.a 
     74}}} 
    6275 
    6376== Simulator == 
     
    173186== Common problems == 
    174187 
    175 === Guide to accept calls in the background after ```kCFStreamNetworkServiceTypeVoIP``` is deprecated (iOS 9) === 
     188=== Guide to accept calls in the background after ```kCFStreamNetworkServiceTypeVoIP``` is deprecated (iOS 9) === #bg-call 
    176189 
    177190Starting in iOS 9, [https://developer.apple.com/library/ios/documentation/CoreFoundation/Reference/CFSocketStreamRef/index.html#//apple_ref/doc/constant_group/Stream_Service_Types kCFStreamNetworkServiceTypeVoIP] is deprecated. Apple recommends that applications use VoIP Push Notifications (using !PushKit framework) to avoid persistent connections as described in the [https://developer.apple.com/library/ios/documentation/Performance/Conceptual/EnergyGuide-iOS/OptimizeVoIP.html Apple's official doc]. This will require application to implement the setup and handling of push notifications in the application layer (for additional guides, you can refer to [http://stackoverflow.com/questions/27245808/implement-pushkit-and-test-in-development-behavior here] and [http://pierremarcairoldi.com/ios-8-voip-notifications/ here]). For now, PJSIP will still use ```kCFStreamNetworkServiceTypeVoIP```, if you want to disable it right away, you can set ```PJ_IPHONE_OS_HAS_MULTITASKING_SUPPORT``` to 0. 
    178  
    179 === Unable to accept incoming call in background mode (iOS4) === 
    180  
    181 If while in the background, ipjsua (or your application) is unable to detect if there is an incoming call and display the local notification: 
    182  1. Note that background feature only works with TCP. 
    183  2. Make sure that voip is included in the required background modes (UIBackgroundModes) in the application’s Info.plist file. 
    184  3. Make sure that the TCP socket is successfully wrapped with CFReadStreamRef (check if there is a message: "Failed to configure TCP transport for VoIP usage"). 
    185  4. Check whether you can accept the incoming call by bringing the app to the foreground. If yes, make sure that the incoming call request comes from the wrapped TCP socket (check the log for the INVITE request). 
    186  
    187 Note: these steps do not troubleshoot audio problems. 
    188191 
    189192=== Audio session management issue (iOS7) === 
     
    203206 - [https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVAudioSession_ClassReference/#//apple_ref/occ/instm/AVAudioSession/overrideOutputAudioPort:error: AVAudioSession::overrideOutputAudioPort] for toggling on/off built-in loudspeaker. 
    204207 
    205 === Audio issue (no audio) (iOS7) === 
    206  
    207 There are a few reports that the audio is not working on iOS 7 (so far it's only reported to happen in iPhone 5) after getting the following error: 
    208  
    209 {{{ 
    210 iPhone mediaserverd[45] <Error>: 10:53:59.986 ERROR:     [0x240b000] 740: _vp: initialize hw input: fs mismatched! REF=0.000000Hz, MIC=44100.000000Hz 
    211 iPhone mediaserverd[45] <Error>: Resampler2 bad sample rate(s) :        0.00    16000.00 
    212 }}} 
    213  
    214 One solution is to set the sound device's clock rate to 44100 Hz as to avoid resampling. 
    215  
    216 === Audio issues (inability to mute, volume control center synchronization, playback reduced volume) (iOS7) === 
    217  
    218 There are several issues with the use of Voice Processing IO Audio Unit in iOS 7, such as unable to mute the volume using the side volume button, unable to synchronize with the control center volume slide bar, significantly reduced volume for audio playback to speaker after a call. Currently there is no workaround for this. Please refer to ticket #1697 for more details. 
    219  
    220 === Supporting multiple architectures (armv6, armv7, armv7s, arm64, and so on) === 
    221  
    222 You need to compile separately for each architecture. If your iPhone SDK has '''{{{llvm-gcc}}}''' compiler (which is the supported compiler starting iOS SDK 5) or '''{{{clang}}}''', then you need to set '''{{{ARCH}}}''' environment variable to the desired architecture before running {{{configure-iphone}}}, for example: 
    223 {{{ 
    224 export ARCH="-arch arm64" 
    225 }}} 
    226  
    227 Then you need to combine the resulting libraries using the '''{{{lipo}}}''' command. For example: 
    228  
    229 {{{ 
    230 lipo -arch armv6 lib/armv6/libpjlib.a -arch armv7 lib/armv7/libpjlib.a -create -output lib/libpjlib.a 
    231 }}} 
    232  
    233 === Unable to support Bluetooth input === 
    234  
    235 Since Bluetooth input support is only available for iOS 3.1 or later, you need to specifically specify that your deployment target is iOS 3.1 or above. You can do this either in '''{{{user.mak}}}''': 
    236 {{{ 
    237 export CFLAGS += -D__IPHONE_OS_VERSION_MIN_REQUIRED=30100 
    238 }}} 
    239 or in '''{{{config_site.h}}}''': 
    240 {{{ 
    241 #define __IPHONE_OS_VERSION_MIN_REQUIRED 30100 
    242 }}} 
    243 You need to recompile PJSIP after this. 
    244  
    245 === Problem with interruption (by a phone call or an alarm), headset plug/unplug, or Bluetooth input === #interruption 
     208=== Crash after calling PJLIB APIs using Grand Central Dispatch (GCD) === #gcd-crash 
     209 
     210PJLIB API should be called from a registered thread, otherwise it will raise assertion such as "Calling pjlib from unknown/external thread...". With GCD, we cannot really be sure of which thread executing the PJLIB function. Registering that thread to PJLIB seems to be a simple and easy solution, however it potentially introduces a random crash which is harder to debug. Here are few possible crash scenarios: 
     211 - PJLIB's {{{pj_thread_desc}}} should remain valid until the registered thread stopped, otherwise crash of invalid pointer access may occur, e.g: in {{{pj_thread_check_stack()}}}. 
     212 - Some compatibility problems between GCD and PJLIB, see #1837 for more info. 
     213 
     214If you want to avoid any possibility of blocking operation by PJLIB (or any higher API layer such as PJMEDIA, PJNATH, PJSUA that usually calls PJLIB), instead of dispatching the task using GCD, the safest way is to create and manage your own thread pool and register that thread pool to PJLIB. Or alternatively, simply use PJSUA timer mechanism (with zero delay), see {{{pjsua_schedule_timer()/pjsua_schedule_timer2()}}} docs for more info. 
     215 
     216=== Audio lost or other issues with interruption (by a phone call or an alarm), headset plug/unplug, or Bluetooth input === #interruption 
    246217 
    247218For devices running iOS 4.0 or later, you need to enable your application to respond to remote-control events. This allows PJSIP to properly receive and process the above events. You can do this by adding the following code in your application: 
     
    251222For more details, please refer to Apple's doc on [http://developer.apple.com/library/ios/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/RemoteControl/RemoteControl.html Remote Control of Multimedia]. 
    252223 
    253 === Audio lost after interruption (iOS 7) === #interruption2 
    254  
    255 It has been reported that any time an audio interruption happens, audio is lost until the application is killed/restarted, also reported that this occurs only on iOS7. 
     224It has also been reported that any time an audio interruption happens, audio is lost until the application is killed/restarted, also reported that this occurs only on iOS7. 
    256225 
    257226Here is the reported working solution: 
     
    270239   1. resume any other media if any 
    271240   1. if sound device was not shutdown forcefully, first connection to the bridge will cause sound device to be started, otherwise manual restarting the sound device, by setting playback & capture device, is required. 
    272  
    273  
    274 === Sound not working in the simulator === 
    275  
    276 Go to System Preferences > Sound > Sound Effects and then uncheck and recheck "Play user interface sound effects". If it still doesn't work, you can try some other suggestions [http://stackoverflow.com/questions/302399/sound-not-working-in-iphone-simulator here]. 
    277241 
    278242=== SIP transport keepalive while in background === #keepalive 
     
    314278 
    315279 
    316 === Crash after calling PJLIB APIs using Grand Central Dispatch (GCD) === #gcd-crash 
    317  
    318 PJLIB API should be called from a registered thread, otherwise it will raise assertion such as "Calling pjlib from unknown/external thread...". With GCD, we cannot really be sure of which thread executing the PJLIB function. Registering that thread to PJLIB seems to be a simple and easy solution, however it potentially introduces a random crash which is harder to debug. Here are few possible crash scenarios: 
    319  - PJLIB's {{{pj_thread_desc}}} should remain valid until the registered thread stopped, otherwise crash of invalid pointer access may occur, e.g: in {{{pj_thread_check_stack()}}}. 
    320  - Some compatibility problems between GCD and PJLIB, see #1837 for more info. 
    321  
    322 If you want to avoid any possibility of blocking operation by PJLIB (or any higher API layer such as PJMEDIA, PJNATH, PJSUA that usually calls PJLIB), instead of dispatching the task using GCD, the safest way is to create and manage your own thread pool and register that thread pool to PJLIB. Or alternatively, simply use PJSUA timer mechanism (with zero delay), see {{{pjsua_schedule_timer()/pjsua_schedule_timer2()}}} docs for more info. 
    323  
     280== Other Problems (problem specific to a particular iOS version/device/simulator) == 
     281 
     282=== Unable to accept incoming call in background mode === 
     283 
     284Starting in iOS 9, this method to accept incoming call in bg is deprecated, please have a look at [#bg-call]. 
     285 
     286If while in the background, ipjsua (or your application) is unable to detect if there is an incoming call and display the local notification: 
     287 1. Note that background feature only works with TCP. 
     288 2. Make sure that voip is included in the required background modes (UIBackgroundModes) in the application’s Info.plist file. 
     289 3. Make sure that the TCP socket is successfully wrapped with CFReadStreamRef (check if there is a message: "Failed to configure TCP transport for VoIP usage"). 
     290 4. Check whether you can accept the incoming call by bringing the app to the foreground. If yes, make sure that the incoming call request comes from the wrapped TCP socket (check the log for the INVITE request). 
     291 
     292Note: these steps do not troubleshoot audio problems. 
     293 
     294=== Audio issue (no audio) (iOS7) === 
     295 
     296There are a few reports that the audio is not working on iOS 7 (so far it's only reported to happen in iPhone 5) after getting the following error: 
     297 
     298{{{ 
     299iPhone mediaserverd[45] <Error>: 10:53:59.986 ERROR:     [0x240b000] 740: _vp: initialize hw input: fs mismatched! REF=0.000000Hz, MIC=44100.000000Hz 
     300iPhone mediaserverd[45] <Error>: Resampler2 bad sample rate(s) :        0.00    16000.00 
     301}}} 
     302 
     303One solution is to set the sound device's clock rate to 44100 Hz as to avoid resampling. 
     304 
     305=== Audio issues (inability to mute, volume control center synchronization, playback reduced volume) (iOS7) === 
     306 
     307There are several issues with the use of Voice Processing IO Audio Unit in iOS 7, such as unable to mute the volume using the side volume button, unable to synchronize with the control center volume slide bar, significantly reduced volume for audio playback to speaker after a call. Currently there is no workaround for this. Please refer to ticket #1697 for more details. 
     308 
     309=== Unable to support Bluetooth input === 
     310 
     311Since Bluetooth input support is only available for iOS 3.1 or later, you need to specifically specify that your deployment target is iOS 3.1 or above. You can do this either in '''{{{user.mak}}}''': 
     312{{{ 
     313export CFLAGS += -D__IPHONE_OS_VERSION_MIN_REQUIRED=30100 
     314}}} 
     315or in '''{{{config_site.h}}}''': 
     316{{{ 
     317#define __IPHONE_OS_VERSION_MIN_REQUIRED 30100 
     318}}} 
     319You need to recompile PJSIP after this. 
     320 
     321=== Sound not working in the simulator === 
     322 
     323Go to System Preferences > Sound > Sound Effects and then uncheck and recheck "Play user interface sound effects". If it still doesn't work, you can try some other suggestions [http://stackoverflow.com/questions/302399/sound-not-working-in-iphone-simulator here]. 
    324324 
    325325=== List of Issues ===