deadlocking thread and portaudio

Philippe Torrelli philippe.torrelli at alcatel.fr
Thu Oct 19 19:20:33 CEST 2006


Hi mikael

The correction works perfectly here.
Thank you.

Philippe.


-----Message d'origine-----
De : minisip-devel-bounces at minisip.org
[mailto:minisip-devel-bounces at minisip.org] De la part de Mikael Magnusson
Envoyé : mercredi 18 octobre 2006 22:39
À : minisip developers' mailing list
Objet : Re: deadlocking thread and portaudio

Philippe Torrelli wrote:
> 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
> 

Please try svn r2863, I fixed a problem in 
PortAudioDevice::writeToDevice, wrong condition variable was used.

Mikael
_______________________________________________
Minisip-devel mailing list
Minisip-devel at minisip.org
http://lists.minisip.org/mailman/listinfo/minisip-devel



More information about the Minisip-devel mailing list