From f6d0dae50e4dd21ad6c10a3774db4da6ba1f5f1e Mon Sep 17 00:00:00 2001 From: olly Date: Fri, 13 Oct 2017 09:31:00 -0700 Subject: [PATCH] Workaround/Fix #3351 1. Ignore edit list where the sequence doesn't contain a sync sample, rather than failing. 2. Make Mp4Extractor.readAtomPayload so it doesn't try and read the same payload twice if a failure occurs parsing it. 3. Make processAtomEnded so that it doesn't pop the moov if parsing it fails. Issue: #3351 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=172106244 --- .../android/exoplayer2/extractor/mp4/AtomParsers.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/library/core/src/main/java/com/google/android/exoplayer2/extractor/mp4/AtomParsers.java b/library/core/src/main/java/com/google/android/exoplayer2/extractor/mp4/AtomParsers.java index 84538b8122..e527f310b3 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/extractor/mp4/AtomParsers.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/extractor/mp4/AtomParsers.java @@ -395,7 +395,11 @@ import java.util.List; hasSyncSample |= (editedFlags[i] & C.BUFFER_FLAG_KEY_FRAME) != 0; } if (!hasSyncSample) { - throw new ParserException("The edited sample sequence does not contain a sync sample."); + // We don't support edit lists where the edited sample sequence doesn't contain a sync sample. + // Such edit lists are often (although not always) broken, so we ignore it and continue. + Log.w(TAG, "Ignoring edit list: Edited sample sequence does not contain a sync sample."); + Util.scaleLargeTimestampsInPlace(timestamps, C.MICROS_PER_SECOND, track.timescale); + return new TrackSampleTable(offsets, sizes, maximumSize, timestamps, flags); } return new TrackSampleTable(editedOffsets, editedSizes, editedMaximumSize, editedTimestamps,