diff options
author | Yoann Lopes <yoann.lopes@qt.io> | 2016-07-15 11:47:41 +0200 |
---|---|---|
committer | Yoann Lopes <yoann.lopes@qt.io> | 2016-08-12 11:17:04 +0000 |
commit | b76958f23e971e25a38ed2b9525dcca1cb3d954d (patch) | |
tree | b97564238c7308946fa7a833c4fe7621404a2dc5 /src/plugins/audiocapture | |
parent | 4f93cd5a7673b5683b12d55c65852e12d556a372 (diff) | |
download | qtmultimedia-b76958f23e971e25a38ed2b9525dcca1cb3d954d.tar.gz |
AudioCapture: fix data chunk size in WAV header
The size in the data chunk was missing 8 bytes.
Task-number: QTBUG-54710
Change-Id: I0530ea9d2420dd90d196993e1678003697c0ebaa
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Diffstat (limited to 'src/plugins/audiocapture')
-rw-r--r-- | src/plugins/audiocapture/audiocapturesession.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/plugins/audiocapture/audiocapturesession.cpp b/src/plugins/audiocapture/audiocapturesession.cpp index 1b183db26..448e8538b 100644 --- a/src/plugins/audiocapture/audiocapturesession.cpp +++ b/src/plugins/audiocapture/audiocapturesession.cpp @@ -342,11 +342,12 @@ void AudioCaptureSession::stop() file.stopProbes(); file.close(); if (m_wavFile) { - qint32 fileSize = file.size()-8; + qint32 fileSize = file.size(); file.open(QIODevice::ReadWrite | QIODevice::Unbuffered); file.read((char*)&header,sizeof(CombinedHeader)); - header.riff.descriptor.size = fileSize; // filesize-8 - header.data.descriptor.size = fileSize-44; // samples*channels*sampleSize/8 + header.riff.descriptor.size = fileSize - 8; // The RIFF chunk size is the file size minus + // the first two RIFF fields (8 bytes) + header.data.descriptor.size = fileSize - 44; // dataSize = fileSize - headerSize (44 bytes) file.seek(0); file.write((char*)&header,sizeof(CombinedHeader)); file.close(); |