summaryrefslogtreecommitdiffstats
path: root/src/multimedia
diff options
context:
space:
mode:
authorJøger Hansegård <joger.hansegard@qt.io>2024-02-26 22:05:58 +0100
committerJøger Hansegård <joger.hansegard@qt.io>2024-02-27 13:21:00 +0100
commitb4147824c6dcf192dfc62e603a5a919a353e88c5 (patch)
tree8e4da2f45416612e68382b36429bcaddd2d3e9ab /src/multimedia
parent5cc5f1985d124e7c3455abbdb3d2a0af6a8c7d00 (diff)
Set correct sample rate and channel count with big endian WAV data
The QWaveDecoder failed to convert sample rate and channel count from big endian to little endian when populating the QAudioFormat. This patch fixes this issue, and revives the QWaveDecoder unit tests from Qt5. Since the QWaveDecoder no longer exposes an API for fetching endianness of the underlying data, the corresponding tests were removed. Still, the tests verify correct handling of both big and little endian. Task-number: QTBUG-122193 Pick-to: 6.7 6.6 6.5 Change-Id: Ia8fe9ab09fa479c3694d827d1505a1616fbacc24 Reviewed-by: Tim Blechmann <tim@klingt.org> Reviewed-by: Mikko Hallamaa <mikko.hallamaa@qt.io> Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
Diffstat (limited to 'src/multimedia')
-rw-r--r--src/multimedia/audio/qwavedecoder.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/multimedia/audio/qwavedecoder.cpp b/src/multimedia/audio/qwavedecoder.cpp
index df5ee32cc..2d2e04e87 100644
--- a/src/multimedia/audio/qwavedecoder.cpp
+++ b/src/multimedia/audio/qwavedecoder.cpp
@@ -373,8 +373,8 @@ void QWaveDecoder::handleData()
}
format.setSampleFormat(fmt);
- format.setSampleRate(/*qFromBigEndian<quint32>*/(wave.sampleRate));
- format.setChannelCount(/*qFromBigEndian<quint16>*/(wave.numChannels));
+ format.setSampleRate(rate);
+ format.setChannelCount(channels);
state = QWaveDecoder::WaitingForDataState;
}