am 9435b498: am f38259cf: Merge "Fix bug in WAVExtractor for 24-bit per sample wav"
* commit '9435b498123f3e22532391c30eb42c336bf743ec':
Fix bug in WAVExtractor for 24-bit per sample wav
diff --git a/media/libstagefright/WAVExtractor.cpp b/media/libstagefright/WAVExtractor.cpp
index d32f4fb..22af6fb 100644
--- a/media/libstagefright/WAVExtractor.cpp
+++ b/media/libstagefright/WAVExtractor.cpp
@@ -426,8 +426,10 @@
return err;
}
+ // make sure that maxBytesToRead is multiple of 3, in 24-bit case
size_t maxBytesToRead =
- mBitsPerSample == 8 ? kMaxFrameSize / 2 : kMaxFrameSize;
+ mBitsPerSample == 8 ? kMaxFrameSize / 2 :
+ (mBitsPerSample == 24 ? 3*(kMaxFrameSize/3): kMaxFrameSize);
size_t maxBytesAvailable =
(mCurrentPos - mOffset >= (off64_t)mSize)
@@ -459,7 +461,7 @@
buffer->set_range(0, n);
- if (mWaveFormat == WAVE_FORMAT_PCM) {
+ if (mWaveFormat == WAVE_FORMAT_PCM || mWaveFormat == WAVE_FORMAT_EXTENSIBLE) {
if (mBitsPerSample == 8) {
// Convert 8-bit unsigned samples to 16-bit signed.