Problem opening Audio Device after AudioCategory change on iPhone

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

 



Hi Tony,

Thanks for the report and the patch. I commit this in r3454.

Best regards,
Ming

On Fri, Feb 18, 2011 at 4:25 PM, Tony Million <tony at bababoo.com> wrote:
> Hi all,
>
> I've noticed a problem where PJSip cannot open the audio device if the audio category changes away from kAudioSessionCategory_PlayAndRecord.
>
> E.g. in our app we have sound effects which require the audio category to be changed to ambient. Once this happens when you try to place a SIP call you will see the following output:
>
> 07:50:31.682 ?pjsua_media.c ?Opening sound device PCM at 16000/1/20ms
> 07:50:32.062 ?pjsua_media.c ?Opening sound device PCM at 44100/1/20ms
> 07:50:32.447 ?pjsua_media.c ?Opening sound device PCM at 48000/1/20ms
> 07:50:32.846 ?pjsua_media.c ?Opening sound device PCM at 32000/1/20ms
> 07:50:33.246 ?pjsua_media.c ?Opening sound device PCM at 16000/1/20ms
> 07:50:33.647 ?pjsua_media.c ?Opening sound device PCM at 8000/1/20ms
> 07:50:34.044 ?pjsua_media.c ?Unable to open sound device: Unknown error -1768403636 [status=-1768403636]
>
> Then the call will fail.
>
> Having dug around in coreaudio_dev I notice the playandrecord category is only set at startup, the following diff makes PJSip set this as it is creating the stream, and fixes the problem.
>
>
> Index: pjmedia/src/pjmedia-audiodev/coreaudio_dev.c
> ===================================================================
> --- pjmedia/src/pjmedia-audiodev/coreaudio_dev.c ? ? ? ?(revision 3415)
> +++ pjmedia/src/pjmedia-audiodev/coreaudio_dev.c ? ? ? ?(working copy)
> @@ -1513,6 +1513,21 @@
> ? ? ? ? ? ? ? ? ? ? ? ? ?PJMEDIA_AUD_DEV_CAP_EC, &ec);
> ? ? }
>
> +#if !COREAUDIO_MAC
> + ? ?/* We want to be able to open playback and recording streams */
> + ? ?UInt32 audioCategory;
> + ? ? ? OSStatus ostatus;
> + ? ?audioCategory = kAudioSessionCategory_PlayAndRecord;
> + ? ?ostatus = AudioSessionSetProperty(kAudioSessionProperty_AudioCategory,
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? sizeof(audioCategory),
> + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? &audioCategory);
> + ? ?if (ostatus != kAudioSessionNoError) {
> + ? ? ? PJ_LOG(4, (THIS_FILE,
> + ? ? ? ? ? ? ? ? ?"Error: cannot set the audio session category (%i)",
> + ? ? ? ? ? ? ? ? ?ostatus));
> + ? ?}
> +#endif
> +
> ? ? strm->io_units[0] = strm->io_units[1] = NULL;
> ? ? if (param->dir == PJMEDIA_DIR_CAPTURE_PLAYBACK &&
> ? ? ? ?param->rec_id == param->play_id)
>
>
> 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
>



[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