diff options
-rw-r--r-- | src/multimedia/audio/qaudioinput_win32_p.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/multimedia/audio/qaudioinput_win32_p.cpp b/src/multimedia/audio/qaudioinput_win32_p.cpp index f28b2e3..cb1baf8 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.cpp +++ b/src/multimedia/audio/qaudioinput_win32_p.cpp @@ -338,6 +338,13 @@ void QAudioInputPrivate::close() deviceState = QAudio::StoppedState; waveInReset(hWaveIn); + + mutex.lock(); + for (int i=0; i<waveFreeBlockCount; i++) + waveInUnprepareHeader(hWaveIn,&waveBlocks[i],sizeof(WAVEHDR)); + freeBlocks(waveBlocks); + mutex.unlock(); + waveInClose(hWaveIn); int count = 0; @@ -345,12 +352,6 @@ void QAudioInputPrivate::close() count++; Sleep(10); } - - mutex.lock(); - for(int i=0; i<waveFreeBlockCount; i++) - waveInUnprepareHeader(hWaveIn,&waveBlocks[i],sizeof(WAVEHDR)); - freeBlocks(waveBlocks); - mutex.unlock(); } int QAudioInputPrivate::bytesReady() const |