nesterenkodm / pjsip

PJSIP is Open Source SIP, Media, and NAT Traversal Library
495 stars 220 forks source link

Are wmme_dev thread safe? #62

Closed orastarter closed 5 years ago

orastarter commented 6 years ago

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 at 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 at 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

welljsjs commented 5 years ago

This is not the official repository of pjsip. This repository aims to make pjsip available for iOS/MacOS platforms. You question does not seem to be related to this repository, but rather to pjsip.

github-actions[bot] commented 5 years ago

This issue is stale because it had been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.