Commit f29af879 by kimvde Committed by kim-vde

FragmentedMp4Extractor: allow both first_sample_flags and sample_flags

Having both in the trun box is not allowed (see section section 8.8.8.1
of ISO/IEC 14496-12:2015) but this CL makes the code more robust in case
this happens. Before this change, the first sample flag was not read,
making subsequent reads incorrect.

Issue: #7698
PiperOrigin-RevId: 325212160
parent 51696525
...@@ -1011,8 +1011,10 @@ public class FragmentedMp4Extractor implements Extractor { ...@@ -1011,8 +1011,10 @@ public class FragmentedMp4Extractor implements Extractor {
checkNonNegative(sampleDurationsPresent ? trun.readInt() : defaultSampleValues.duration); checkNonNegative(sampleDurationsPresent ? trun.readInt() : defaultSampleValues.duration);
int sampleSize = int sampleSize =
checkNonNegative(sampleSizesPresent ? trun.readInt() : defaultSampleValues.size); checkNonNegative(sampleSizesPresent ? trun.readInt() : defaultSampleValues.size);
int sampleFlags = (i == 0 && firstSampleFlagsPresent) ? firstSampleFlags int sampleFlags =
: sampleFlagsPresent ? trun.readInt() : defaultSampleValues.flags; sampleFlagsPresent
? trun.readInt()
: (i == 0 && firstSampleFlagsPresent) ? firstSampleFlags : defaultSampleValues.flags;
if (sampleCompositionTimeOffsetsPresent) { if (sampleCompositionTimeOffsetsPresent) {
// The BMFF spec (ISO 14496-12) states that sample offsets should be unsigned integers in // The BMFF spec (ISO 14496-12) states that sample offsets should be unsigned integers in
// version 0 trun boxes, however a significant number of streams violate the spec and use // version 0 trun boxes, however a significant number of streams violate the spec and use
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment