diff options
author | Lars Knoll <lars.knoll@qt.io> | 2021-05-21 14:08:18 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2021-05-21 12:28:41 +0000 |
commit | faaa989d87831b2d287e6170af4a44cdef087780 (patch) | |
tree | 436a1e095f0af5354bab24e56db6b0c2960e6955 /tests | |
parent | 6e93058aa909875225319edf1ebb4d2d1697d527 (diff) |
Fix the qaudioinput test failures on macOS
There was a race condition in the code as the audio samples can be read
read the device from a separate thread.
Also the buffer to write to needs to be opened.
Change-Id: I89896a8e3258999d51e1415f75df979405306937
Reviewed-by: Doris Verria <doris.verria@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/integration/qaudioinput/BLACKLIST | 2 | ||||
-rw-r--r-- | tests/auto/integration/qaudioinput/tst_qaudioinput.cpp | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/tests/auto/integration/qaudioinput/BLACKLIST b/tests/auto/integration/qaudioinput/BLACKLIST deleted file mode 100644 index 0b76f6f8a..000000000 --- a/tests/auto/integration/qaudioinput/BLACKLIST +++ /dev/null @@ -1,2 +0,0 @@ -[reset] -macos diff --git a/tests/auto/integration/qaudioinput/tst_qaudioinput.cpp b/tests/auto/integration/qaudioinput/tst_qaudioinput.cpp index dcbc9f5b5..3b8dc6fd4 100644 --- a/tests/auto/integration/qaudioinput/tst_qaudioinput.cpp +++ b/tests/auto/integration/qaudioinput/tst_qaudioinput.cpp @@ -142,8 +142,10 @@ void tst_QAudioInput::initTestCase() QAudioFormat format; format.setChannelCount(1); - if (audioDevice.isFormatSupported(audioDevice.preferredFormat())) - testFormats.append(audioDevice.preferredFormat()); + if (audioDevice.isFormatSupported(audioDevice.preferredFormat())) { + if (format.sampleFormat() == QAudioFormat::Int16) + testFormats.append(audioDevice.preferredFormat()); + } // PCM 11025 mono S16LE format.setSampleRate(11025); @@ -715,6 +717,7 @@ void tst_QAudioInput::reset() { QAudioInput audioInput(audioFormat, this); QBuffer buffer; + buffer.open(QIODevice::WriteOnly); QSignalSpy stateSignal(&audioInput, SIGNAL(stateChanged(QAudio::State))); |