Sound device not closed on call disconnect

SA
sufi al hussaini hassani kamili raheemi
Tue, Dec 20, 2016 11:53 AM

Hi,

I'm using PJSUA in a python script to play incoming call audio on the sound
device.
The problem I'm having is that sometimes the sound device isn't closed even
after the call is disconnected, although I see in the logs that the sound
device was closed. This happens intermittently and not always.

Logs

14:48:19.100    pjsua_aud.c  Closing sound device after idle for 1 second(s)
14:48:19.100    pjsua_aud.c  .Closing sunxi-CODEC: sunxi PCM (hw:0,0) sound
playback device and sunxi-CODEC: sunxi PCM (hw:0,0) sound capture device

fuser -v /dev/snd/*

                 USER        PID ACCESS COMMAND

/dev/snd/pcmC0D0c:  root      8357 F...m sip_speaker.py
/dev/snd/pcmC0D0p:  root      8357 F...m sip_speaker.py

I'm using the same code as here
https://gist.github.com/Sufi-Al-Hussaini/6d00be6316013fdde5e5ed20549ebbef,
except that I'm doing a little more work on call state change (to
disconnected) and on incoming call. I'm able to reproduce this problem by
simply adding sleep(3) at line 59 & 115 of my code and making calls in
rapid succession.

I'm not sure what's wrong with my code, but it looks like some sort of a
race condition.

--

Thanks and regards,
Shoaib Ahmed.
System Software Developer,
Kindows Tech Solutions,
Knowledge Oasis Muscat (KOM),
Rusayl, Sultanate of Oman.

Hi, I'm using PJSUA in a python script to play incoming call audio on the sound device. The problem I'm having is that sometimes the sound device isn't closed even after the call is disconnected, although I see in the logs that the sound device *was* closed. This happens intermittently and not always. # Logs 14:48:19.100 pjsua_aud.c Closing sound device after idle for 1 second(s) 14:48:19.100 pjsua_aud.c .Closing sunxi-CODEC: sunxi PCM (hw:0,0) sound playback device and sunxi-CODEC: sunxi PCM (hw:0,0) sound capture device # fuser -v /dev/snd/* USER PID ACCESS COMMAND /dev/snd/pcmC0D0c: root 8357 F...m sip_speaker.py /dev/snd/pcmC0D0p: root 8357 F...m sip_speaker.py I'm using the same code as here <https://gist.github.com/Sufi-Al-Hussaini/6d00be6316013fdde5e5ed20549ebbef>, except that I'm doing a little more work on call state change (to disconnected) and on incoming call. I'm able to reproduce this problem by simply adding sleep(3) at line 59 & 115 of my code and making calls in rapid succession. I'm not sure what's wrong with my code, but it looks like some sort of a race condition. -- Thanks and regards, *Shoaib Ahmed.* System Software Developer, Kindows Tech Solutions, Knowledge Oasis Muscat (KOM), Rusayl, Sultanate of Oman.