summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLev Zelenskiy <lev.zelenskiy@nokia.com>2012-06-29 05:56:43 (GMT)
committerQt by Nokia <qt-info@nokia.com>2012-07-03 06:05:34 (GMT)
commitd3c02f0c51f9cf69245a42ee690d90cd657c5fe2 (patch)
treeb9fffe1c01d2c5da8027bab4282685048ad02ea5
parent0e595ad22db04141bfbd6093824cdcc775fd371d (diff)
downloadQt-d3c02f0c51f9cf69245a42ee690d90cd657c5fe2.zip
Qt-d3c02f0c51f9cf69245a42ee690d90cd657c5fe2.tar.gz
Qt-d3c02f0c51f9cf69245a42ee690d90cd657c5fe2.tar.bz2
Clean buffers before closing the input device.
Input device handle is invalid after waveInClose() QTBUG-24119 Change-Id: I3b2554f816f5ca66be4d992a0a579561639caf9f Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
-rw-r--r--src/multimedia/audio/qaudioinput_win32_p.cpp13
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