From cb064917cf070aaac48a3a04e0179638801e6565 Mon Sep 17 00:00:00 2001 From: James Dong Date: Mon, 5 Dec 2011 12:41:06 -0800 Subject: [PATCH] DO NOT MERGE - Consider I-Frame at zeroeth position when searching for sync frames The current logic does not check the I-frame at zeroeth position and therefore for the files with only 1 I-Frame at zeroeth postion does not play. Originally authored by Braganza Sam Robertsh Do not merge to master branch since we made some improvement to SampleTable.cpp in the master branch. Change-Id: I068184dec71986f14a586f769c2af1f52b4bcf94 related-to-bug: 5711942 --- media/libstagefright/SampleTable.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/media/libstagefright/SampleTable.cpp b/media/libstagefright/SampleTable.cpp index 69d178592bd75..bf319472ffe21 100644 --- a/media/libstagefright/SampleTable.cpp +++ b/media/libstagefright/SampleTable.cpp @@ -627,6 +627,14 @@ status_t SampleTable::findSyncSampleNear( ++left; } + + if (left == mNumSyncSamples) { + if (flags == kFlagAfter) { + LOGE("tried to find a sync frame after the last one: %d", left); + return ERROR_OUT_OF_RANGE; + } + } + if (left > 0) { --left; }