Skip to content

Commit 214b5ac

Browse files
torokati44kinetiknz
authored andcommitted
Only skip trailing ctts content in non-strict mode.
1 parent 49fc621 commit 214b5ac

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

mp4parse/src/lib.rs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4475,7 +4475,7 @@ fn read_stbl<T: Read>(
44754475
track.stss = Some(stss);
44764476
}
44774477
BoxType::CompositionOffsetBox => {
4478-
let ctts = read_ctts(&mut b)?;
4478+
let ctts = read_ctts(&mut b, strictness)?;
44794479
debug!("{:?}", ctts);
44804480
track.ctts = Some(ctts);
44814481
}
@@ -4747,7 +4747,10 @@ fn read_stsc<T: Read>(src: &mut BMFFBox<T>) -> Result<SampleToChunkBox> {
47474747

47484748
/// Parse a Composition Time to Sample Box
47494749
/// See ISOBMFF (ISO 14496-12:2020) § 8.6.1.3
4750-
fn read_ctts<T: Read>(src: &mut BMFFBox<T>) -> Result<CompositionOffsetBox> {
4750+
fn read_ctts<T: Read>(
4751+
src: &mut BMFFBox<T>,
4752+
strictness: ParseStrictness,
4753+
) -> Result<CompositionOffsetBox> {
47514754
let (version, _) = read_fullbox_extra(src)?;
47524755

47534756
let counts = be_u32(src)?;
@@ -4780,8 +4783,12 @@ fn read_ctts<T: Read>(src: &mut BMFFBox<T>) -> Result<CompositionOffsetBox> {
47804783
})?;
47814784
}
47824785

4783-
// Padding could be added in some contents.
4784-
skip_box_remain(src)?;
4786+
if strictness == ParseStrictness::Strict {
4787+
check_parser_state!(src.content);
4788+
} else {
4789+
// Padding may be present in some content.
4790+
skip_box_remain(src)?;
4791+
}
47854792

47864793
Ok(CompositionOffsetBox { samples: offsets })
47874794
}

0 commit comments

Comments
 (0)