Segfault with pjsua_set_snd_dev (concurrency problem)

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

 



[I tried to send this message via gmane, but it seems it has not reached
the list, so I send it again, with modifications due to new findings]

Hello,

I am new to VoIP and pjsip and as an exercise I try to understand and
extend the pjsua sample application.

I am using pjproject-1.3 on Ubuntu 9.10alpha and testing against
Asterisk softswitch that is running on another PC on the local net.

Now I modified pjsua to to set the playback device depending on the call
state. If there is no call, the sound goes to the PC speaker,
if there is an active call, it goes to an USB handset,
Capture device is always the handset. I change the sound device with
pjsua_set_snd_dev().

This basically works, but pjsua segfaults when a call is terminated.

This only happens if I set --snd-auto-close to certain values (Bad
traces below are with value 0).

It seems that close_snd_dev is called from different threads
concurrently, one call is coming from the auto close, the other comes
from the application due to the pjsua_set_snd_dev() call.

For unknown reasons, pjmedia_snd_port_destroy() which is called from
close_snd_dev takes more than one second on this system, so the second
thread calls close_snd_dev while first thread is still in
pjmedia_snd_port_destroy and tries to close the same sound device
again-> Crash

I have added some additional logging to show the call sequence. The
number in <> is the thread id pthread_self(). The logs are attached to
this mail to keep the formatting.

Are there any restrictions when pjsua_set_sound_dev resp. close_snd_dev
can be called? Documentation says "Application may call this function at
any time to replace current sound device".


Regards,

Wolfgang


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: log.txt
URL: <http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20090730/3ff2359d/attachment.txt>


[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