]> granicus.if.org Git - taglib/commitdiff
Correctly handle non-integral bit depths
authorStephen F. Booth <me@sbooth.org>
Tue, 31 Jan 2012 03:31:15 +0000 (22:31 -0500)
committerStephen F. Booth <me@sbooth.org>
Tue, 31 Jan 2012 03:31:15 +0000 (22:31 -0500)
taglib/riff/wav/wavproperties.cpp

index c8b7fd6b9a44ae995696f43542d3a3713a2a0388..f04539686e74a0e1058497303d5f41a4a10ce1e6 100644 (file)
@@ -125,5 +125,5 @@ void RIFF::WAV::Properties::read(const ByteVector &data)
 
   d->length = byteRate > 0 ? d->streamLength / byteRate : 0;
   if(d->channels > 0 && d->sampleWidth > 0)
-    d->sampleFrames = d->streamLength / (d->channels * (d->sampleWidth / 8));
+    d->sampleFrames = d->streamLength / (d->channels * ((d->sampleWidth + 7) / 8));
 }