Now I can reproduce it. So, here I'm using my app linked against pjproject-1.8.5 build with CoreAudio support. I have a Plantronics USB headset and headphones. When I'm on a call and I'm using standard sound output (computer speakers or headphones), and then I'm plugging or unplugging headphones, I'm getting underflows and assertion: 21:40:29.976 ec0x1159a2ee0 Underflow, buf_cnt=0, will generate 1 frame 21:40:29.998 ec0x1159a2ee0 Underflow, buf_cnt=0, will generate 1 frame 21:40:30.019 ec0x1159a2ee0 Underflow, buf_cnt=0, will generate 1 frame Assertion failed: (thread->signature1 != 0xDEAFBEEF || thread->signature2 != 0xDEADC0DE || (thread->thread == pthread_self())), function pj_thread_register, file ../src/pj/os_core_unix.c, line 403. But when I'm on a call and I'm using a USB headset, then I'm switching to the standard output, and then I'm plugging or unplugging headphones, everything is fine. There is no assertion and the sound is being transfered to the speakers or headphones. Alexei On Sat, Nov 6, 2010 at 9:20 PM, Alexei Kuznetsov <eofster at gmail.com> wrote: > On Sat, Nov 6, 2010 at 8:50 PM, Mr. Gecko <grmrgecko at gmail.com> wrote: >> Is it crashing for you too? > > Not always and I can't reproduce it right now. > > What even more strange is that everything's okay when I'm using > pjsua-lib in my app. In that case when I'm plugging or unplugging > headphones, pjsip goes silent, generates some underflows and then > sound re-appears and underflow messages are not generated any more. > But when I'm using pjsua tool from exactly the same build, the sound > stops and underflow messages never end, as I wrote before. > > Alexei > > >> On Nov 6, 2010, at 12:34 PM, Alexei Kuznetsov wrote: >> >>> Here's what happens when I plug or unplug headphones: >>> >>> 20:26:18.140 ? ?pjsua_app.c ?Call 1 state changed to CONFIRMED >>> 20:26:18.452 ? ? ? stream.c ?G722 codec used, remote samples per >>> frame detected = 160 >>> 20:26:18.769 strm0x1008f154 ?VAD re-enabled >>> 20:26:19.175 ? sound_port.c ?EC activated >>> 20:26:22.223 ? Master/sound ?Buffer size adjusted from 1175 to 696 >>> (eff_cnt=559) >>> 20:26:23.162 ?ec0x100314310 ?Underflow, buf_cnt=0, will generate 1 frame >>> 20:26:23.205 ? Master/sound ?Buffer size adjusted from 1016 to 581 >>> (eff_cnt=559) >>> 20:26:24.004 ?ec0x100314310 ?Underflow, buf_cnt=0, will generate 1 frame >>> 20:26:24.965 ?ec0x100314310 ?Underflow, buf_cnt=0, will generate 1 frame >>> >>> And so on. And the sound stops. >>> >>> I configured pjsproject 1.8.5 with the following settings in config_site.h: >>> #define PJSIP_DONT_SWITCH_TO_TCP 1 >>> #define PJMEDIA_AUDIO_DEV_HAS_COREAUDIO 1 >>> >>> I built it on the 64-bit iMac with Mac OS X 10.6.4 and used pjsua >>> tool. Here's file output: >>> $ file pjsua-i386-apple-darwin10.4.0 >>> pjsua-i386-apple-darwin10.4.0: Mach-O 64-bit executable x86_64 >>> >>> Alexei