iOS, remote audio lost after interruption by an alarm

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

 



Hello,

We are using PJSIP in a SIP calling application for iPhone. We currently 
have one problem with audio interruption on iOS 4.2 when in a call. We 
use PJSIP coreaudio_dev as is with no changes. So other PJSIP users will 
likely experience the same problem. It happens in 100% of attempts.

Following are the easy steps to reproduce it (assuming you already have 
working calling application based on pjsip. I refer to such application 
as "APP"):

1) "APP" registers with the SIP server, makes a SIP call. (for example, 
one could call 8800 on Asterisk based SIP server). Stay on this call, 
send "APP" to the background. Remote audio still can be heard.
2) Now go to the "Clock" application on iPhone and set up an alarm to 
happen a a minute later from current time. Close the "Clock" app.
3) At this point DO NOT put "APP" in the foreground. Observe the call is 
still active in the background, red bar indicates that, you can hear the 
remote audio.
4) The alarm happens as scheduled. It plays some sound and shows the 
dialog. Press OK on the dialog. Alarm sound stops, the dialog gets 
dismissed.
5) At this point there is no red bar any more. The remote audio can not 
be heard any more.
6) Put "APP" in the foreground, observe the call itself is still active. 
Just the remote audio has gone.

===

Tracking down the error, I see that in coreaudio_dev.c, after audio 
interruption ended, the interruptionListener() is called. This one calls 
propListener() as shown below:

     .....
     if (inInterruption == kAudioSessionEndInterruption) {
     strm->interrupted = PJ_FALSE;
     /* There may be an audio route change during the interruption
      * (such as when the alarm rings), so we have to notify the
      * listener as well.
      */
     propListener(strm, kAudioSessionProperty_AudioRouteChange,
              0, NULL);
     } else if (inInterruption == kAudioSessionBeginInterruption) {
    ....

Then propListener(), in turn, tries to recreate the audio device and 
fails with the log message below:

     ....
     if (create_audio_unit(strm->cf->io_comp, 0,
                       strm->param.dir, strm,
&strm->io_units[0]) != PJ_SUCCESS)
     {
         PJ_LOG(3, (THIS_FILE,
            "Error: failed to create a new instance of audio unit"));
         return;
     }
     ....

I added more logging and learned that create_audio_unit() fails on the 
following line:

     /* Initialize the audio unit */
     ostatus = AudioUnitInitialize(*io_unit);

and ostatus is -12985.

====

Did anybody see that problem? Did anybody fix it? Any thoughts?

Thanks,
Dmitry








[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