Are wmme_dev thread safe?

A
Alex
Fri, Feb 16, 2018 3:17 PM

Hi!

We use pjsip 2.6 in c# wpf softphone.
Our softphone calls pjmedia_aud_dev_refresh(); each 1 second for refresh
list of record and player devices.
Sometimes  when incoming call apears this method conflicts
with init_player_stream and we got next errors:
Error retrieving default audio device parameters: Invalid audio device
or
Error opening sound device: Invalid value or argument

We have tried to log pjisp and found next:

...
13:32:12.980  pjsua_call.c  Answering call 1: code=200
...
13:32:12.981    pjsua_aud.c  .....Opening sound device (speaker + mic)
PCM@16000/1/20ms
13:32:12.992    wmme_dev.c  ...... WaveAPI Sound player "Динамики
(Plantronics .Audio 628 USB)" initialized (format=PCM, clock_rate=16000,
channel_count=1, samples_per_frame=320 (20ms))
13:32:12.996    wmme_dev.c  ...... WaveAPI Sound recorder "Микрофон
(Plantronics .Audio 628 USB)" initialized (format=PCM, clock_rate=16000,
channel_count=1, samples_per_frame=320 (20ms))
...
13:42:04.756  pjsua_call.c  Answering call 2: code=200
...
13:42:04.757    pjsua_aud.c  .....Opening sound device (speaker + mic)
PCM@16000/1/20ms
<--------------->
13:42:04.765  Calls  pjmedia_aud_dev_refresh();
<--------------->
13:42:04.769    wmme_dev.c !...... WaveAPI Sound player "" initialized
(format=PCM, clock_rate=16000, channel_count=1, samples_per_frame=320
(20ms))
13:42:04.769    wmme_dev.c  ......Stopped WMME playback stream
...

As we understand method pjmedia_aud_dev_refresh makes aud_subsys.dev_cnt =
0;
and after this another thread can't initialize sound....

Is it bug of pjsip? Perhaps wmme_dev methods should be thread safe? Or we
need change logic for stop calling  pjmedia_aud_dev_refresh() when
incomming call appears?

Best regards, Alex

Hi! We use pjsip 2.6 in c# wpf softphone. Our softphone calls pjmedia_aud_dev_refresh(); each 1 second for refresh list of record and player devices. Sometimes when incoming call apears this method conflicts with init_player_stream and we got next errors: Error retrieving default audio device parameters: Invalid audio device or Error opening sound device: Invalid value or argument We have tried to log pjisp and found next: ... 13:32:12.980 pjsua_call.c Answering call 1: code=200 ... 13:32:12.981 pjsua_aud.c .....Opening sound device (speaker + mic) PCM@16000/1/20ms 13:32:12.992 wmme_dev.c ...... WaveAPI Sound player "Динамики (Plantronics .Audio 628 USB)" initialized (format=PCM, clock_rate=16000, channel_count=1, samples_per_frame=320 (20ms)) 13:32:12.996 wmme_dev.c ...... WaveAPI Sound recorder "Микрофон (Plantronics .Audio 628 USB)" initialized (format=PCM, clock_rate=16000, channel_count=1, samples_per_frame=320 (20ms)) ... 13:42:04.756 pjsua_call.c Answering call 2: code=200 ... 13:42:04.757 pjsua_aud.c .....Opening sound device (speaker + mic) PCM@16000/1/20ms <---------------> 13:42:04.765 Calls pjmedia_aud_dev_refresh(); <---------------> 13:42:04.769 wmme_dev.c !...... WaveAPI Sound player "" initialized (format=PCM, clock_rate=16000, channel_count=1, samples_per_frame=320 (20ms)) 13:42:04.769 wmme_dev.c ......Stopped WMME playback stream ... As we understand method pjmedia_aud_dev_refresh makes aud_subsys.dev_cnt = 0; and after this another thread can't initialize sound.... Is it bug of pjsip? Perhaps wmme_dev methods should be thread safe? Or we need change logic for stop calling pjmedia_aud_dev_refresh() when incomming call appears? -- Best regards, Alex