CoreAudioOutput use timeout when waiting for render thread

On Snow Leopard (at least), changing the default audio device while
audio is playing can cause CoreAudioOutput to freeze in
audioThreadStop(). It seems that the OS stops calling renderCallback
when the device changes, so audioThreadStop() waits forever.

Change-Id: If7244cc50f12295ff91a979ef50e3bee1273affd
Reviewed-by: Andy Nichols <andy.nichols@digia.com>
This commit is contained in:
Dyami Caliri
2014-07-22 11:19:14 -07:00
parent ff527de013
commit c93c1d1dc3

View File

@@ -698,14 +698,14 @@ void CoreAudioOutput::audioThreadStop()
{
stopTimers();
if (m_audioThreadState.testAndSetAcquire(Running, Stopped))
m_threadFinished.wait(&m_mutex);
m_threadFinished.wait(&m_mutex, 500);
}
void CoreAudioOutput::audioThreadDrain()
{
stopTimers();
if (m_audioThreadState.testAndSetAcquire(Running, Draining))
m_threadFinished.wait(&m_mutex);
m_threadFinished.wait(&m_mutex, 500);
}
void CoreAudioOutput::audioDeviceStop()