audit: guard 0xFD video routing, carry frame duration, add cap tests

Round-5 findings from the 10-phase release audit:

- collect_es routed EVERY extended-stream-id (0xFD) PES into the video ES
  buffer, so a 0xFD HD-audio sub-stream (MLP/TrueHD) could pollute the
  video sample and — if it preceded the video PES — stamp the video track
  with the audio PID, losing the video. Only the VC-1 extension (0x55) is
  now treated as video; routing 0xFD audio to its own track is deferred to
  the HD-DVD program-chain follow-up.
- The sparse-PTS reorder now carries its calibrated per-frame duration onto
  each frame, so the muxer emits a BlockDuration and the back-patched
  Segment Duration covers the final frame instead of understating it.
- Add regression tests for the MAX_MARKS and MAX_VTI_HITS caps (promote
  MAX_VTI_HITS to module scope); make the differential-test factory array a
  named type; drop an identity-op in a reorder test.
This commit is contained in:
Matthew Jackson
2026-07-09 17:59:04 -07:00
parent c81a6e05cd
commit 9066433c29
3 changed files with 74 additions and 11 deletions
+5 -1
View File
@@ -190,6 +190,10 @@ impl SparsePtsReorder {
let mut out = Vec::with_capacity(pend.len());
for (mut p, didx) in pend.into_iter().zip(dispidx) {
p.frame.pts_ns = origin + didx * dur;
// Carry the calibrated per-frame duration so the muxer emits a
// BlockDuration and the back-patched Segment Duration covers the
// final frame (the source gives no duration on this path).
p.frame.duration_ns = Some(dur as u64);
out.push(p.frame);
}
// Next GOP with no anchor continues after this one's last display slot.
@@ -295,7 +299,7 @@ mod tests {
// GOP 1 decode order I P B P B -> display indices 0 2 1 4 3 -> PTS:
assert_eq!(
&got[0..5],
&[0, 2 * dur, 1 * dur, 4 * dur, 3 * dur],
&[0, 2 * dur, dur, 4 * dur, 3 * dur],
"GOP1 display PTS in decode order"
);
// GOP 2 re-locks origin to 5*dur.