Crash in coreaudio_dev on iphone

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ok thats fine, my only question would be how to signal to pj media that the audio should stop and restart when I get the begin / end interruption signal?

Regards,
-- 
Tony Million


On 4 Feb 2011, at 11:10, Ming wrote:

> Hi Tony,
> 
> Yes, that's right, you will overwrite coreaudio_dev's callback and
> handle the interruption case at the application level.
> 
> Regards,
> Ming
> 
> On Fri, Feb 4, 2011 at 6:03 PM, Tony Million <tony at bababoo.com> wrote:
>> Hi Ming,
>> 
>> I dont quite understand what you mean, wouldn't our AudioSession over-write the PJSIP one?
>> Sorry to ask, but can you explain this a little better?
>> 
>> 
>> 
>> What we do in our app is:
>> 
>> main
>> {
>>        register callback handler for reachbility
>> }
>> 
>> callback handler
>> {
>>        (release resources if necessary)
>>        pjsua_destroy();
>> 
>>        if(connectable)
>>        {
>>                .. obviously all the setup here
>>                pjsua_init();
>> 
>>                (alloc resources)
>>                pjsua_start();
>>        }
>> }
>> 
>> The callback handler is called for any network state change (that is wifi->wifi, wifi->3g wifi->no signal (and the same for all 3G states too)). So in this way when pjsua starts up again it is bound to the correctly connected network interface. Unless there is a method of telling pjsua to rebind to the active network interface that I have missed, this is the only way I have found to handle network transitions.
>> 
>> 
>> 
>> Also, as a footnote since we are talking about reachability , there is still a compatibility in os_darwinos.h when including <SystemConfiguration/SystemConfiguration.h> the following diff will fix it
>> 
>> Index: pjlib/include/pj/compat/os_darwinos.h
>> ===================================================================
>> --- pjlib/include/pj/compat/os_darwinos.h       (revision 3410)
>> +++ pjlib/include/pj/compat/os_darwinos.h       (working copy)
>> @@ -95,7 +95,10 @@
>>  /*
>>  * Socket related
>>  */
>> -typedef int socklen_t;
>> +#ifndef _SOCKLEN_T
>> +#define _SOCKLEN_T
>> +typedef        __darwin_socklen_t      socklen_t;
>> +#endif
>> 
>>  /* Set 1 if native sockaddr_in has sin_len member.
>>  * Default: 0
>> 
>> 
>> 
>> 
>> Regards,
>> --
>> Tony Million
>> Chief Technology Officer - Bababoo Inc
>> Web: http://www.bababoo.com/
>> Tel: +44 20 7993 9152
>> Twitter: @bababoo
>> 
>> On 4 Feb 2011, at 09:09, Ming wrote:
>> 
>>> Hi Tony,
>>> 
>>> In the case that you need to restart pjsua, you will need to create
>>> your own interruptionListener handler. You can do this by calling
>>> AudioSessionInitialize() before coreaudio calls this function.
>>> 
>>> Regards,
>>> Ming
>>> 
>>> On Thu, Feb 3, 2011 at 4:22 PM, Tony Million <tony at bababoo.com> wrote:
>>>> I've investigated more, and found the following:
>>>> When our app detects a change in network (i.e. changing from wifi to 3G or
>>>> wifi->different wifi, or even losing signal entirely) we shutdown pjsip
>>>> using pjsua_destroy() then, if/when a network is available we reinitialize
>>>> pjsua using the same startup code we used in the first instance.
>>>> When restarting pjsua I see the following error:
>>>>  08:13:52.942 sip_endpoint.c  Module "mod-invite" registered
>>>>  08:13:52.942 coreaudio_dev.   dev_id 0: iPhone IO device  (in=1, out=1)
>>>> 8000Hz
>>>>  08:13:52.942 coreaudio_dev.  Error: cannot initialize audio session
>>>> services (1768843636)
>>>>  08:13:52.943 coreaudio_dev.  core audio initialized
>>>>  08:13:52.943          pjlib  select() I/O Queue created (0x9dba14)
>>>>  08:13:52.979 sip_endpoint.c  Module "mod-evsub" registered
>>>> 
>>>> At this point, when I go to make a cellular call, I'll see the same crash I
>>>> pasted (pasted again for completeness
>>>>  08:14:57.383 coreaudio_dev.  Session interrupted! --- Begin Interruption
>>>> ---
>>>> Assertion failed: (mutex), function pj_mutex_lock, file
>>>> ../src/pj/os_core_unix.c, line 1203.
>>>> Program received signal:  ?SIGABRT?.
>>>> At
>>>> As far as I know the only way to get pjsua to work correctly with the new
>>>> network interface (be it the 3G WWAN or WIFI Network) is to call
>>>> pjsua_destroy and then start up pjsua again. If this is incorrect I'm happy
>>>> to change my code. If I do not shutdown/restart pjsua eventually I just
>>>> start getting 502 (Timeout) responses from pjsua.
>>>> 
>>>> Hope this helps,
>>>> Tony
>>>> On 3 Feb 2011, at 05:06, Ming wrote:
>>>> 
>>>> Hi Tony,
>>>> 
>>>> Thanks for the report. Is the crash always reproducible (i.e. does it
>>>> happen every time you make a call)?
>>>> Do you set up your own audio session interruptions in your
>>>> application? Is there any log message from PJSIP on audio session
>>>> initialization error (Error: cannot initialize audio session
>>>> services...)?
>>>> 
>>>> Regards,
>>>> Ming
>>>> 
>>>> On Thu, Feb 3, 2011 at 2:24 AM, Tony Million <tony at bababoo.com> wrote:
>>>> 
>>>> Hi,
>>>> 
>>>> I've been seeing crashes related to audio session interruptions on the
>>>> 
>>>> iphone for a while, and just got one while the app is connected to a
>>>> 
>>>> debugger.
>>>> 
>>>> I've attached the logs, I had made a call on cellular and just switched back
>>>> 
>>>> to the PJSip based app.
>>>> 
>>>> I have numerous crash logs showing the same thing but today is the first day
>>>> 
>>>> I could catch it in the debugger. Don't know if this helps, I'm running
>>>> 
>>>> current trunk.
>>>> 
>>>>  18:08:27.718 coreaudio_dev.  Session interrupted! --- Begin Interruption
>>>> 
>>>> ---
>>>> 
>>>> Assertion failed: (mutex), function pj_mutex_lock, file
>>>> 
>>>> ../src/pj/os_core_unix.c, line 1203.
>>>> 
>>>> Program received signal:  ?SIGABRT?.
>>>> 
>>>> (gdb) bt
>>>> 
>>>> #0  0x33bd52d4 in __kill ()
>>>> 
>>>> #1  0x33bd52ca in kill ()
>>>> 
>>>> #2  0x33bd52bc in raise ()
>>>> 
>>>> #3  0x33be9d78 in abort ()
>>>> 
>>>> #4  0x33bd7986 in __assert_rtn ()
>>>> 
>>>> #5  0x00076258 in pj_mutex_lock ()
>>>> 
>>>> #6  0x000aa114 in interruptionListener ()
>>>> 
>>>> #7  0x31730772 in SSServer_AudioSessionDeferredListenerMessage ()
>>>> 
>>>> #8  0x316ddf2e in _XAudioSessionDeferredListenerMessage ()
>>>> 
>>>> #9  0x31677bea in mshMIGPerform ()
>>>> 
>>>> #10 0x33a556fe in __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__
>>>> 
>>>> ()
>>>> 
>>>> #11 0x33a556c2 in __CFRunLoopDoSource1 ()
>>>> 
>>>> #12 0x33a47f7c in __CFRunLoopRun ()
>>>> 
>>>> #13 0x33a47c86 in CFRunLoopRunSpecific ()
>>>> 
>>>> #14 0x33a47b8e in CFRunLoopRunInMode ()
>>>> 
>>>> #15 0x33b0e4aa in GSEventRunModal ()
>>>> 
>>>> #16 0x33b0e556 in GSEventRun ()
>>>> 
>>>> #17 0x32099328 in -[UIApplication _run] ()
>>>> 
>>>> #18 0x32096e92 in UIApplicationMain ()
>>>> 
>>>> #19 0x00002cbc in main (argc=1, argv=0x2fdff67c) at
>>>> 
>>>> /Users/tony/Projects/IOS/main.m:14
>>>> 
>>>> 
>>>> Regards,
>>>> 
>>>> --
>>>> 
>>>> Tony Million
>>>> 
>>>> _______________________________________________
>>>> 
>>>> Visit our blog: http://blog.pjsip.org
>>>> 
>>>> pjsip mailing list
>>>> 
>>>> pjsip at lists.pjsip.org
>>>> 
>>>> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>>>> 
>>>> 
>>>> 
>>>> _______________________________________________
>>>> Visit our blog: http://blog.pjsip.org
>>>> 
>>>> pjsip mailing list
>>>> pjsip at lists.pjsip.org
>>>> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>>>> 
>>>> 
>>>> _______________________________________________
>>>> Visit our blog: http://blog.pjsip.org
>>>> 
>>>> pjsip mailing list
>>>> pjsip at lists.pjsip.org
>>>> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>>>> 
>>>> 
>>> 
>>> _______________________________________________
>>> Visit our blog: http://blog.pjsip.org
>>> 
>>> pjsip mailing list
>>> pjsip at lists.pjsip.org
>>> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>> 
>> 
>> _______________________________________________
>> Visit our blog: http://blog.pjsip.org
>> 
>> pjsip mailing list
>> pjsip at lists.pjsip.org
>> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>> 
> 
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
> 
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org




[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux