summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/WAVExtractor.cpp
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2014-11-06 17:49:48 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2014-11-06 17:49:48 -0800
commite1a2df553a6d151807a5da738a3cd853bef908d9 (patch)
tree9015c1c9ad9ec69f1962657f70fe3df386fbb05a /media/libstagefright/WAVExtractor.cpp
parentbcf093bfef277a8ec0119da9e84e5abac58ad0b1 (diff)
parent841daebc75fbf5e7fb4dd71cab559b8f4d7150ae (diff)
downloadframeworks_av-e1a2df553a6d151807a5da738a3cd853bef908d9.zip
frameworks_av-e1a2df553a6d151807a5da738a3cd853bef908d9.tar.gz
frameworks_av-e1a2df553a6d151807a5da738a3cd853bef908d9.tar.bz2
Resolve conflict
Diffstat (limited to 'media/libstagefright/WAVExtractor.cpp')
-rw-r--r--media/libstagefright/WAVExtractor.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/media/libstagefright/WAVExtractor.cpp b/media/libstagefright/WAVExtractor.cpp
index fe9058b..a4a651d 100644
--- a/media/libstagefright/WAVExtractor.cpp
+++ b/media/libstagefright/WAVExtractor.cpp
@@ -414,7 +414,7 @@ status_t WAVSource::read(
} else {
pos = (seekTimeUs * mSampleRate) / 1000000 * mNumChannels * (mBitsPerSample >> 3);
}
- if (pos > mSize) {
+ if (pos > (off64_t)mSize) {
pos = mSize;
}
mCurrentPos = pos + mOffset;
@@ -439,6 +439,10 @@ status_t WAVSource::read(
maxBytesToRead = maxBytesAvailable;
}
+ // read only integral amounts of audio unit frames.
+ const size_t inputUnitFrameSize = mNumChannels * mBitsPerSample / 8;
+ maxBytesToRead -= maxBytesToRead % inputUnitFrameSize;
+
if (mWaveFormat == WAVE_FORMAT_MSGSM) {
// Microsoft packs 2 frames into 65 bytes, rather than using separate 33-byte frames,
// so read multiples of 65, and use smaller buffers to account for ~10:1 expansion ratio