Reduced lock contention when playing and immediately querying the status of a SoundStream.

This commit is contained in:
binary1248 2014-11-09 23:55:47 +01:00
parent fc850ed99f
commit 32bafa98a4

View File

@ -274,6 +274,7 @@ void SoundStream::streamData()
m_isStreaming = false; m_isStreaming = false;
return; return;
} }
}
// Create the buffers // Create the buffers
alCheck(alGenBuffers(BufferCount, m_buffers)); alCheck(alGenBuffers(BufferCount, m_buffers));
@ -286,6 +287,9 @@ void SoundStream::streamData()
// Play the sound // Play the sound
alCheck(alSourcePlay(m_source)); alCheck(alSourcePlay(m_source));
{
Lock lock(m_threadMutex);
// Check if the thread was launched Paused // Check if the thread was launched Paused
if (m_threadStartState == Paused) if (m_threadStartState == Paused)
alCheck(alSourcePause(m_source)); alCheck(alSourcePause(m_source));