Merge "Ignore audio sync sample list" am: f9ac0e84e2 am: 34dec945e6
am: ee3eb46566
Change-Id: I97d4f6c2d2eb3dac74626cfd9edc1831b38cee37
diff --git a/media/extractors/mp4/MPEG4Extractor.cpp b/media/extractors/mp4/MPEG4Extractor.cpp
index c776c51..4298b57 100755
--- a/media/extractors/mp4/MPEG4Extractor.cpp
+++ b/media/extractors/mp4/MPEG4Extractor.cpp
@@ -142,6 +142,7 @@
uint8_t *mSrcBuffer;
bool mIsHeif;
+ bool mIsAudio;
sp<ItemTable> mItemTable;
// Start offset from composition time to presentation time.
@@ -4530,6 +4531,7 @@
}
mIsPcm = !strcasecmp(mime, MEDIA_MIMETYPE_AUDIO_RAW);
+ mIsAudio = !strncasecmp(mime, "audio/", 6);
if (mIsPcm) {
int32_t numChannels = 0;
@@ -5416,8 +5418,11 @@
findFlags = SampleTable::kFlagBefore;
}
- uint32_t syncSampleIndex;
- if (err == OK) {
+ uint32_t syncSampleIndex = sampleIndex;
+ // assume every audio sample is a sync sample. This works around
+ // seek issues with files that were incorrectly written with an
+ // empty or single-sample stss block for the audio track
+ if (err == OK && !mIsAudio) {
err = mSampleTable->findSyncSampleNear(
sampleIndex, &syncSampleIndex, findFlags);
}