deadlocking thread and portaudio
Philippe Torrelli
philippe.torrelli at alcatel.fr
Wed Oct 18 17:25:28 CEST 2006
Hello,
I already tried to send it directly to mikael, but as I got no response,
I'm not sure he received it. no harrassing intended..
In case it's of interest:
Here I have a problem with portaudio when my computer is busy .
(
minisip_textui on windows XP,
with portaudio ( dx only ),
simple muxer,
G711 codec ,
P4 2.8 Ghz
( if there is anything else of interest, let me know )
)
The symptom : speech works ok, and suddenly an infinity of ^ is displayed
in minisip_textui.
Here I reproduce it easily, just keep speaking with the other party and
alt-tab a few time the minisip_textui window
I debugged a bit to find out that the thread running SoundIO ::playerLoop is
locked in PortAudioDevice ::writeToDevice
if( available < nBytes ){
#ifdef PA_DEBUG
char buf[128];
snprintf(buf, sizeof(buf), "writeToDevice wait %ld < %ld");
merr << buf << end;
#endif
outMutex.unlock();
inCond.wait(); <- Locked HERE
continue;
}
My understanding is that the pc is in Cond.wait()
because when the writeToDevice was Entered,
there was no room left in the buffer to write the data.
Since then, in the portaudio thread that is running
PortAudioDevice::callback, room has been made in this buffer..
So the other thread should try again, but it's waiting for infinity.
So my suggestion would be to add a timeout to the condwait so that
it doesn't wait for infinity.
in PortAudioDevice::writeToDevice I changed
inCond.wait();
into
inCond.wait(5);
and it solved the problem here.
Hope it helps
Philippe Torrelli
More information about the Minisip-devel
mailing list