summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPiotr Srebrny <piotr.srebrny@qt.io>2021-10-28 13:27:42 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-11-02 15:21:24 +0000
commit4f95d8ff5f6b7b08c3f96541f51c112e00753b2c (patch)
tree3ae9cf64584022059714d9a38a6cdce860db8201
parent86ded826ab68c6d72aeef2993ac04aba264cde83 (diff)
downloadqtmultimedia-4f95d8ff5f6b7b08c3f96541f51c112e00753b2c.tar.gz
Enable QAudioDecoder backend tests for Windows
The patch enables the QAudioDecoder backend tests for Windows with minor adjustments. The expected duration time of the resampled file has been reduced as the Windows resampler produces slightly shorter audio after resampling. Additionally, the expected error code when reading invalid file is changed to ResourceError, which is better suited for this case than AccessDeniedError that relates to lack of permission. Change-Id: Iaf905a66c6e03d6ba6d5c9afd4fc8e88b9cb7840 Reviewed-by: André de la Rocha <andre.rocha@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Doris Verria <doris.verria@qt.io> (cherry picked from commit fad168fcbc13bb3ab4c110cf3734f3e5cd83e3b4) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/multimedia/platform/darwin/audio/avfaudiodecoder.mm2
-rw-r--r--src/multimedia/platform/gstreamer/audio/qgstreameraudiodecoder.cpp2
-rw-r--r--tests/auto/integration/qaudiodecoderbackend/BLACKLIST2
-rw-r--r--tests/auto/integration/qaudiodecoderbackend/tst_qaudiodecoderbackend.cpp13
4 files changed, 8 insertions, 11 deletions
diff --git a/src/multimedia/platform/darwin/audio/avfaudiodecoder.mm b/src/multimedia/platform/darwin/audio/avfaudiodecoder.mm
index 079c4b39e..0b76eaa73 100644
--- a/src/multimedia/platform/darwin/audio/avfaudiodecoder.mm
+++ b/src/multimedia/platform/darwin/audio/avfaudiodecoder.mm
@@ -329,7 +329,7 @@ void AVFAudioDecoder::start()
}
if (m_device && (!m_device->isOpen() || !m_device->isReadable())) {
- processInvalidMedia(QAudioDecoder::AccessDeniedError, tr("Unable to read from specified device"));
+ processInvalidMedia(QAudioDecoder::ResourceError, tr("Unable to read from specified device"));
return;
}
diff --git a/src/multimedia/platform/gstreamer/audio/qgstreameraudiodecoder.cpp b/src/multimedia/platform/gstreamer/audio/qgstreameraudiodecoder.cpp
index dc44a1c38..361bf2207 100644
--- a/src/multimedia/platform/gstreamer/audio/qgstreameraudiodecoder.cpp
+++ b/src/multimedia/platform/gstreamer/audio/qgstreameraudiodecoder.cpp
@@ -317,7 +317,7 @@ void QGstreamerAudioDecoder::start()
} else if (mDevice) {
// make sure we can read from device
if (!mDevice->isOpen() || !mDevice->isReadable()) {
- processInvalidMedia(QAudioDecoder::AccessDeniedError, QLatin1String("Unable to read from specified device"));
+ processInvalidMedia(QAudioDecoder::ResourceError, QLatin1String("Unable to read from specified device"));
return;
}
diff --git a/tests/auto/integration/qaudiodecoderbackend/BLACKLIST b/tests/auto/integration/qaudiodecoderbackend/BLACKLIST
deleted file mode 100644
index 316c5a083..000000000
--- a/tests/auto/integration/qaudiodecoderbackend/BLACKLIST
+++ /dev/null
@@ -1,2 +0,0 @@
-# QTBUG-56796
-windows
diff --git a/tests/auto/integration/qaudiodecoderbackend/tst_qaudiodecoderbackend.cpp b/tests/auto/integration/qaudiodecoderbackend/tst_qaudiodecoderbackend.cpp
index 5e3132d25..d7031ee70 100644
--- a/tests/auto/integration/qaudiodecoderbackend/tst_qaudiodecoderbackend.cpp
+++ b/tests/auto/integration/qaudiodecoderbackend/tst_qaudiodecoderbackend.cpp
@@ -160,7 +160,7 @@ void tst_QAudioDecoderBackend::fileTest()
buffer = d.read();
QVERIFY(buffer.isValid());
QTRY_VERIFY(!positionSpy.isEmpty());
- QVERIFY(positionSpy.takeLast().at(0).toLongLong() == qint64(duration / 1000));
+ QCOMPARE(positionSpy.takeLast().at(0).toLongLong(), qint64(duration / 1000));
duration += buffer.duration();
sampleCount += buffer.sampleCount();
@@ -234,7 +234,7 @@ void tst_QAudioDecoderBackend::fileTest()
byteCount += buffer.byteCount();
// Now drain the decoder
- if (duration < 998000) {
+ if (duration < 996000) {
QTRY_COMPARE(d.bufferAvailable(), true);
}
@@ -242,14 +242,14 @@ void tst_QAudioDecoderBackend::fileTest()
buffer = d.read();
QVERIFY(buffer.isValid());
QTRY_VERIFY(!positionSpy.isEmpty());
- QVERIFY(positionSpy.takeLast().at(0).toLongLong() == qint64(duration / 1000));
+ QCOMPARE(positionSpy.takeLast().at(0).toLongLong(), qint64(duration / 1000));
QVERIFY(d.position() - (duration / 1000) < 20);
duration += buffer.duration();
sampleCount += buffer.sampleCount();
byteCount += buffer.byteCount();
- if (duration < 998000) {
+ if (duration < 996000) {
QTRY_COMPARE(d.bufferAvailable(), true);
}
}
@@ -501,9 +501,8 @@ void tst_QAudioDecoderBackend::invalidSource()
// Check the error code.
QTRY_VERIFY(!errorSpy.isEmpty());
errorCode = qvariant_cast<QAudioDecoder::Error>(errorSpy.takeLast().at(0));
- QCOMPARE(errorCode, QAudioDecoder::AccessDeniedError);
- QCOMPARE(d.error(), QAudioDecoder::AccessDeniedError);
-
+ QCOMPARE(errorCode, QAudioDecoder::ResourceError);
+ QCOMPARE(d.error(), QAudioDecoder::ResourceError);
// Check all other spies.
QVERIFY(readySpy.isEmpty());
QVERIFY(bufferChangedSpy.isEmpty());