Delay when using coreaudio_dev. Was: Plugging or unplugging headphones on a Mac

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

 



Hi Alexei,

What a coincidence, I think we may have just fixed it in ticket #1192
(http://trac.pjsip.org/repos/ticket/1192). It seems that the delay was
caused by coreaudio trying to open the hardware at a different sample
rate than it supports. Normally it shouldn't cause the lengthy delay,
however it looks like your audio device takes a bit of time before
rejecting being opened at 16KHz. With the latest fix, coreaudio will
just use Mac's AudioConverter to do the resampling.

Please give it a try and let me know.

Thanks,
Ming

On Sun, Dec 19, 2010 at 10:04 PM, Alexei Kuznetsov <eofster at gmail.com> wrote:
> On 17 Dec, 2010, at 16:48, Ming wrote:
>
>> Regarding the delay, I am not aware of such problem before and it can
>> be caused by so many things. So it would be great if you can reproduce
>> it using pjsua or if you can pinpoint which instruction or function
>> that causes the delay so that we can fix it.
>
> It's about two seconds, right after hitting Enter in pjsua to make a call. It's happening on the main thread, so my app linked against pjsua-lib freezes as pjsua here.
>
> Make call: sip:5271762 at sipgate.co.uk
> ?16:37:09.537 ?pjsua_media.c ?Opening sound device PCM at 16000/1/20ms
> ?[here's the delay visible with the naked eye when calling]
> ?16:37:11.548 coreaudio_dev. ?core audio stream stopped
> ?16:37:11.549 ?pjsua_media.c ?Opening sound device PCM at 44100/1/20ms
> ?16:37:11.552 ?ec0x1003268b0 ?AEC created, clock_rate=44100, channel=1, samples per frame=882, tail length=200 ms, latency=20 ms
> ?16:37:12.564 coreaudio_dev. ?core audio stream started
> ?16:37:12.564 ? pjsua_call.c ?Making call with acc #2 to sip:5271762 at sipgate.co.uk
> ?16:37:12.564 ?pjsua_media.c ?Media index 0 selected for call 0
> ?16:37:12.565 ? pjsua_core.c ?TX 1101 bytes Request msg INVITE/cseq=25820 (tdta0x10091f400) to UDP 217.10.79.23:5060:
> INVITE sip:5271762 at sipgate.co.uk SIP/2.0
>
>
> And here's the same call from pjsua build with portaudio support.
>
> Make call: sip:5271762 at sipgate.co.uk
> ?16:47:34.866 ?pjsua_media.c ?Opening sound device PCM at 16000/1/20ms
> ?16:47:34.901 ?ec0x10031c4a0 ?AEC created, clock_rate=16000, channel=1, samples per frame=320, tail length=200 ms, latency=20 ms
> ?16:47:35.914 ? pjsua_call.c ?Making call with acc #2 to sip:5271762 at sipgate.co.uk
> ?16:47:35.915 ?pjsua_media.c ?Media index 0 selected for call 0
> ?16:47:35.916 ? pjsua_core.c ?TX 1100 bytes Request msg INVITE/cseq=8124 (tdta0x101015400) to UDP 217.10.79.23:5060:
> INVITE sip:5271762 at sipgate.co.uk SIP/2.0
>
>
> I understand that I probably can make call from the secondary thread (can I?), but as there wasn't such problem with portaudio, maybe we could do something to eliminate the delay? Without that there will be more unnecessary complications with call management in all apps that use pjsua-lib API.
>
> Alexei
> _______________________________________________
> 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