Relax parsing of ctts sample deltas

Issue: #3384

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=174715851
This commit is contained in:
olly 2017-11-06 09:21:01 -08:00 committed by Oliver Woodman
parent 2daa098a20
commit ea80c3e456

View file

@ -247,7 +247,13 @@ import java.util.List;
remainingSamplesAtTimestampDelta--;
if (remainingSamplesAtTimestampDelta == 0 && remainingTimestampDeltaChanges > 0) {
remainingSamplesAtTimestampDelta = stts.readUnsignedIntToInt();
timestampDeltaInTimeUnits = stts.readUnsignedIntToInt();
// The BMFF spec (ISO 14496-12) states that sample deltas should be unsigned integers
// in stts boxes, however some streams violate the spec and use signed integers instead.
// See https://github.com/google/ExoPlayer/issues/3384. It's safe to always decode sample
// deltas as signed integers here, because unsigned integers will still be parsed
// correctly (unless their top bit is set, which is never true in practice because sample
// deltas are always small).
timestampDeltaInTimeUnits = stts.readInt();
remainingTimestampDeltaChanges--;
}