Allow MP4s with truncated stco to be played

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=219448836
This commit is contained in:
andrewlewis 2018-10-31 03:37:24 -07:00 committed by Oliver Woodman
parent b007cbf2b4
commit b1d5966ea5

View File

@ -221,11 +221,22 @@ import java.util.List;
for (int i = 0; i < sampleCount; i++) {
// Advance to the next chunk if necessary.
while (remainingSamplesInChunk == 0) {
Assertions.checkState(chunkIterator.moveNext());
boolean chunkDataComplete = true;
while (remainingSamplesInChunk == 0 && (chunkDataComplete = chunkIterator.moveNext())) {
offset = chunkIterator.offset;
remainingSamplesInChunk = chunkIterator.numSamples;
}
if (!chunkDataComplete) {
Log.w(TAG, "Unexpected end of chunk data");
sampleCount = i;
offsets = Arrays.copyOf(offsets, sampleCount);
sizes = Arrays.copyOf(sizes, sampleCount);
timestamps = Arrays.copyOf(timestamps, sampleCount);
flags = Arrays.copyOf(flags, sampleCount);
remainingSamplesAtTimestampOffset = 0;
remainingTimestampOffsetChanges = 0;
break;
}
// Add on the timestamp offset if ctts is present.
if (ctts != null) {