A couple of quick fixes to avoid deadlocks during playback.

This commit is contained in:
bjorn.olievier 2008-05-10 07:30:40 +00:00
parent b32241ea8a
commit a822298c61

View File

@ -194,7 +194,7 @@ bool WaveOut::Shutdown(void)
{ {
Close(); Close();
boost::mutex::scoped_lock lock(this->audioMutex); // boost::mutex::scoped_lock lock(this->audioMutex);
if(this->audioThread) if(this->audioThread)
{ {
@ -286,11 +286,11 @@ bool WaveOut::SetFormat(unsigned long SampleRate, unsigned long Channels)
// //
bool WaveOut::Start(void) bool WaveOut::Start(void)
{ {
boost::mutex::scoped_lock lock(this->audioMutex);
if(!Open()) if(!Open())
return(false); return(false);
boost::mutex::scoped_lock lock(this->audioMutex);
while(m_QueuedBuffers) // Handles pause/play? while(m_QueuedBuffers) // Handles pause/play?
{ {
waveOutWrite(m_waveHandle, &m_Buffers[m_ActiveBuffer], sizeof(WAVEHDR)); waveOutWrite(m_waveHandle, &m_Buffers[m_ActiveBuffer], sizeof(WAVEHDR));