audit: void empty-timeline duration, cover sniff overlap

Round-11 findings from the 10-phase release audit (no real HIGH):

- When a no-declared-duration source (HD-DVD) muxes a degenerate single
  frame at tick 0 with no per-frame duration, max_block_ticks stays 0 and
  the reserved DURATION placeholder was left as a literal 0.0 (players read
  that as a zero-length file). Void the element instead, so the Segment
  omits DURATION as an unknown-duration source did before the back-patch.
- Add a regression test for the sniff_video_codec overlap fix (a
  picture_start_code whose payload begins 00 00 followed by a real start
  code) so the i+=4 marker skip can't silently regress to i+=3.
This commit is contained in:
Matthew Jackson
2026-07-09 20:40:54 -07:00
parent 640502d5a8
commit 18082d0df1
2 changed files with 46 additions and 0 deletions
+16
View File
@@ -708,6 +708,22 @@ mod tests {
// A slice/picture-only sample (no SPS/sequence) is indeterminate.
assert_eq!(sniff_video_codec(&[0x00, 0x00, 0x01, 0x61, 0x9A]), None);
assert_eq!(sniff_video_codec(&[0xDE, 0xAD, 0xBE, 0xEF]), None);
// Overlap regression: a picture_start_code (0x00) whose payload begins
// with 00 00 must advance a full 4 bytes so the code byte isn't re-read
// as the start of a new marker. Here the picture is followed by a real
// MPEG-2 sequence header — the scan must reach it cleanly and return
// Mpeg2 (and, critically, not be confused by the 1-byte overlap).
assert_eq!(
sniff_video_codec(&[0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0xB3, 0x2D]),
Some(Codec::Mpeg2)
);
// A lone picture_start_code with a 00-heavy payload and no following real
// start code stays indeterminate (the overlap must not fabricate one).
assert_eq!(
sniff_video_codec(&[0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00]),
None
);
}
#[test]