diff options
-rw-r--r-- | src/multimedia/audio/qaudiooutput_win32_p.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp index ef4bf0e..2c4a1c2 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.cpp +++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp @@ -189,7 +189,6 @@ void QAudioOutputPrivate::stop() { if(deviceState == QAudio::StopState) return; - deviceState = QAudio::StopState; close(); if(!pullMode && audioSource) { delete audioSource; @@ -465,13 +464,15 @@ bool QAudioOutputPrivate::deviceReady() } else if(l == 0) { bytesAvailable = bytesFree(); + int check = 0; EnterCriticalSection(&waveOutCriticalSection); - if(waveFreeBlockCount == buffer_size/period_size) { + check = waveFreeBlockCount; + LeaveCriticalSection(&waveOutCriticalSection); + if(check == buffer_size/period_size) { errorState = QAudio::UnderrunError; deviceState = QAudio::IdleState; emit stateChanged(deviceState); } - LeaveCriticalSection(&waveOutCriticalSection); } else if(l < 0) { bytesAvailable = bytesFree(); |