summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Shih <robertshih@google.com>2016-09-20 17:37:55 -0700
committergitbuildkicker <android-build@google.com>2016-09-27 15:56:40 -0700
commit2af81c25f462ba958507bfe6ba43200e3c2e2a0e (patch)
treea8d28e9a48695f4334b65457a19aabed9934fae6
parentc2dd82bfd6d7aea5b6760efc0712ae11d7a52e6b (diff)
downloadframeworks_av-2af81c25f462ba958507bfe6ba43200e3c2e2a0e.zip
frameworks_av-2af81c25f462ba958507bfe6ba43200e3c2e2a0e.tar.gz
frameworks_av-2af81c25f462ba958507bfe6ba43200e3c2e2a0e.tar.bz2
SampleIterator: clear members on seekTo error
Bug: 31091777 Change-Id: Iddf99d0011961d0fd3d755e57db4365b6a6a1193 (cherry picked from commit 03237ce0f9584c98ccda76c2474a4ae84c763f5b)
-rw-r--r--media/libstagefright/SampleIterator.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/media/libstagefright/SampleIterator.cpp b/media/libstagefright/SampleIterator.cpp
index c5f359e..335bd5d 100644
--- a/media/libstagefright/SampleIterator.cpp
+++ b/media/libstagefright/SampleIterator.cpp
@@ -94,8 +94,6 @@ status_t SampleIterator::seekTo(uint32_t sampleIndex) {
+ mFirstChunk;
if (!mInitialized || chunk != mCurrentChunkIndex) {
- mCurrentChunkIndex = chunk;
-
status_t err;
if ((err = getChunkOffset(chunk, &mCurrentChunkOffset)) != OK) {
ALOGE("getChunkOffset return error");
@@ -106,18 +104,21 @@ status_t SampleIterator::seekTo(uint32_t sampleIndex) {
uint32_t firstChunkSampleIndex =
mFirstChunkSampleIndex
- + mSamplesPerChunk * (mCurrentChunkIndex - mFirstChunk);
+ + mSamplesPerChunk * (chunk - mFirstChunk);
for (uint32_t i = 0; i < mSamplesPerChunk; ++i) {
size_t sampleSize;
if ((err = getSampleSizeDirect(
firstChunkSampleIndex + i, &sampleSize)) != OK) {
ALOGE("getSampleSizeDirect return error");
+ mCurrentChunkSampleSizes.clear();
return err;
}
mCurrentChunkSampleSizes.push(sampleSize);
}
+
+ mCurrentChunkIndex = chunk;
}
uint32_t chunkRelativeSampleIndex =