Skip to content

fix(sw): HEVC packet coverage follows successors, and a full one forgets history (AE#613) - #614

Merged
superuser404notfound merged 1 commit into
mainfrom
fix/613-coverage
Sep 23, 2026
Merged

superuser404notfound merged 1 commit into
mainfrom
fix/613-coverage

Conversation

@superuser404notfound

Copy link
Copy Markdown
Owner

Fixes the two coverage defects in #613, both found while answering #592.

  • HEVC takes the successor-timestamp model H.264 already used (SoftwarePlaybackHost.presentationReorderDepth(codecID:)), under FFmpeg's own bound: hevc/ps.c rejects sps_max_num_reorder_pics above 15, inside the 32-timestamp queue. Rounded container durations no longer split the coverage at every frame.
  • A full coverage forgets the ranges wholly behind the playhead instead of freezing (duration model) or invalidating itself (successor model). A backward cached seek into forgotten history goes cold, which is correct.

Verification:

  • Issue613PacketCoverageTests: the codec test and both cap tests fail without the change and pass with it.
  • Full swift test green (629 XCTest, 3367 swift-testing), plus the three standalone coverage/read-ahead scripts.
  • Real media, 4K HEVC Matroska with 41 ms durations over an HTTP origin, aetherctl play --sw: buf 0.4 s ahead of the playhead before, 39.8 s after, no starvation lines.

Does not touch #592's turnover.

🤖 Generated with Claude Code

https://claude.ai/code/session_014AVNwe8YDG9EQM7uHdjT3f

…ets history (AE#613)

HEVC kept the strict pts + duration coverage, which tolerates no gap. A
Matroska file muxed with 41 ms durations against 41/42 ms deltas at 23.976
fps left a one-tick hole at every 42 ms step: 0.70 islands a frame, so the
frontier, bufferedPosition and the cached-seek eligibility all ended at the
next rounding hole. HEVC now takes the successor-timestamp model H.264
already used. Its reorder bound is FFmpeg's own: hevc/ps.c rejects
sps_max_num_reorder_pics above 15, inside the 32-timestamp queue.

Coverage keeps its history behind the playhead for backward cached seeks,
capped at 4096 ranges. A full coverage used to stop describing new packets
(duration model, insert returned false and nobody read it) or invalidate
itself (successor model), so every frontier after the cap was nil. It now
forgets the ranges wholly behind the playhead first; a backward cached seek
into forgotten history goes cold, which is correct.

Measured on a 4K HEVC Matroska fixture over an HTTP origin, aetherctl
--sw: buf 0.4 s ahead of the playhead before, 39.8 s after (the forward
window). Tests fail without each half and pass with it.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_014AVNwe8YDG9EQM7uHdjT3f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant