Skip to content

fix(live): one frame more no longer buys a whole second of fastZap TARGETDURATION (#670) - #691

Merged
superuser404notfound merged 1 commit into
mainfrom
fix/670-gop-headroom-cliff
Oct 3, 2026
Merged

superuser404notfound merged 1 commit into
mainfrom
fix/670-gop-headroom-cliff

Conversation

@superuser404notfound

Copy link
Copy Markdown
Owner

Round 2 of #670, from the 59.94 fps data point in #670.

Problem

The fastZap GOP headroom term was ceil(1.5 x max EXTINF). At 59.94 fps with 1.001 s GOPs:

longest segment x 1.5 before after
79 frames, 1.318 s 1.977 2 2
80 frames, 1.335 s 2.002 3 2
89 frames, 1.485 s 2.228 3 2

One millisecond of segment duration bought 1 s of TARGETDURATION and 3 s of holdback. On a rebuild with a 6 s backlog, that 9 s holdback forced a bounded start.

Fix

LiveEdgePolicy.targetDurationForGOPHeadroom asks what the term is for. It returns the smallest TD under which a GOP 1.5 x the longest seen:

  • lists legally, because RFC 8216 4.3.3.1 compares the EXTINF rounded to nearest with TD, and
  • finishes inside AVPlayer's 1.5 x TD patience with 0.5 s to spare. That is the margin round 1 already accepted for the reported 2.4 s GOP at TD 2.

Segments up to 1.666 s now seal 2, and 1 s GOPs keep TD 2. The new value is never above the old one (tested over 0.3 to 12 s in 1 ms steps). Ingested segments and .standard are untouched. The seal line now states what the term needs: 1.5 x max EXTINF 2.002s needs 2s.

Measured

Fixture: a 59.94 fps H.264 TS seed with keyframes every 60 frames plus one extra at frame 100, which makes the third segment 80 frames. Run with aetherctl live --fast-zap --realtime --preroll 6 --seconds 60, two runs per arm:

arm seal first manifest #361 startup 8/8 presenting
main TD 3, holdback 9 s bounded start after 1.345 s 2.94 / 2.95 s
branch TD 2, holdback 6 s immediate 0.37 / 0.39 s

Neither arm showed a -12888, -12642 or stall. With --preroll 0 the session seals before the 80-frame segment arrives (TD 2 on both arms). main then logs later candidate 3s (max segment 1.335s) and the branch logs no candidate.

swift test: 714 XCTest passed. Swift Testing had one failure in Issue281ColdStartRoundTripTests (a 10 s network-timing test under full-suite load). It passes in isolation on both the branch and main.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WJcXkGQrMiBPixVEFTSBJS

…RGETDURATION (#670)

The fastZap GOP headroom took ceil(1.5 x max EXTINF). On a 59.94 fps
source with 1.001 s GOPs a 79-frame segment (1.318 s) sealed 2 and an
80-frame one (1.335 s, 2.002 x 1.5) sealed 3, a 9 s holdback that a 6 s
rebuild backlog could not hold: bounded start, first frame 2.5 s later.

The term now asks what it is for: the smallest TARGETDURATION under which
a GOP 1.5 x the longest seen still lists (RFC 8216 rounds EXTINF to the
nearest integer) and finishes inside AVPlayer's 1.5 x TD patience with
0.5 s to spare. Segments up to 1.666 s seal 2, 1 s GOPs keep 2, and the
value is never above the old one.

Measured with aetherctl live --fast-zap --realtime --preroll 6 on a
59.94 fps seed with one 80-frame segment, two runs per arm: main sealed 3,
served bounded after 1.345 s and presented at 2.94 to 2.95 s; the branch
sealed 2 and presented at 0.37 to 0.39 s. No -12888 or stall in either.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WJcXkGQrMiBPixVEFTSBJS
@superuser404notfound
superuser404notfound merged commit 2880a95 into main Oct 3, 2026
4 checks passed
@superuser404notfound
superuser404notfound deleted the fix/670-gop-headroom-cliff branch October 3, 2026 04:51
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