Skip to content

fix(live): fastZap seals headroom over the GOPs it cuts - #676

Merged
superuser404notfound merged 1 commit into
mainfrom
fix/ae670-fastzap-td-headroom
Sep 30, 2026
Merged

superuser404notfound merged 1 commit into
mainfrom
fix/ae670-fastzap-td-headroom

Conversation

@superuser404notfound

Copy link
Copy Markdown
Owner

Refs #670.

Root cause

Under .fastZap the cut target (0.5 s) is below any real GOP, so every segment the engine cuts is one whole source GOP. TARGETDURATION is sealed from the first window and never moves (RFC 8216, AE#209). On the reported source that window held three 1.000 s GOPs: sealed at 1, holdback 3 s, zero headroom. The source's GOPs are irregular (1.0 to 2.4 s), so every longer one:

.standard never had this because its ceil(1.5 x cut target) floor is exactly that headroom. Under fastZap it collapses to ceil(0.75) = 1.

Fix

Where the engine cuts the segments itself and the cut target is sub-second, the seal also takes ceil(1.5 x max EXTINF). 1 s GOPs now serve TARGETDURATION 2 / HOLD-BACK 6, the value the fastZap reporter already verified on real origins in #195. Not applied to:

The seal line names the new term: 1.5 x max EXTINF 1.500s (each segment is one whole GOP).

Measured

aetherctl live --fast-zap --realtime --preroll 0 --seconds 90, two passes per arm. The seed is a 50 fps H.264 + AAC TS with GOPs 1.0 x 8, then 1.0 / 1.12 / 2.4 / 2.0 mixed.

arm seal stalls playlist refused (-12642) SW fallback #446 join
main, irregular 1 s 1 / 1 1 / 1 yes / yes 1 / 1 1.14 / 1.23 s
branch, irregular 2 s 0 / 0 0 / 0 no / no 0 / 0 1.38 / 1.42 s
branch, regular 1 s GOP 2 s 0 / 0 0 / 0 no / no 0 / 0 1.38 / 1.38 s

macOS AVPlayer refuses the non-conforming playlist outright. The reporter's tvOS one degrades to -12888 and freezes instead.

What is left over. #524 still fires 3 to 4 times per run on the irregular seed at 1.6 to 2.0 s of runway, with no stall. That comes from the bounded start serving a 3 s window under the 6 s holdback (#594), not from the seal.

Cost. A fastZap channel with 1 s GOPs plays 6 s behind the live edge instead of 3 s. The join itself grows by about 0.2 s, because the bounded start serves after two segments either way.

Tests

  • New Issue670FastZapGOPHeadroomTests: reported seal, later 2.4 s GOP inside it, scaling, ingest unchanged, .standard unchanged, seal account.
  • Issue195FastLiveJoinTests and LiveWindowObservedCadenceTests moved to the new self-cut values. The invariants they pin (TD tracks GOP, hold = 3 x sealed TD) are unchanged.
  • Full suite: 654 XCTest green. swift-testing 3933 green; Issue445VMRegionCensusTests failed once under parallel load and then passed 3 / 3 in isolation (unrelated, process memory census).

🤖 Generated with Claude Code

https://claude.ai/code/session_01WJcXkGQrMiBPixVEFTSBJS

Reported in AE#670. Under .fastZap the cut target (0.5 s) sits below any real GOP, so every
segment the engine cuts is one whole source GOP, and TARGETDURATION was
sealed from the first few with no headroom over them. A broadcast whose
GOPs run 1.0 to 2.4 s sealed TD 1 on three 1.000 s ones, then broke
EXTINF <= TD on every longer GOP and held the playlist unchanged past
AVPlayer's 1.5 x TD patience: -12888, #446 reading the source as dead,
#524 on 1.5 s of runway, and on macOS the playlist refused as a parse
error (-12642) with a fall to the software path.

Self-cut fastZap segments now seal ceil(1.5 x max EXTINF), the headroom
.standard always had from its 1.5 x cut-target floor. Ingested segments
(bounded by the upstream's own TD, AE#447) and .standard are unchanged.

Measured with aetherctl live --fast-zap --realtime --preroll 0 on a seed
with that GOP pattern, two passes per arm: main sealed 1 s, one stall,
-12642 and a software fallback on both; this branch sealed 2 s, none of
the three on either. Regular 1 s GOPs: join 1.38 s against 1.14 / 1.23 s.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WJcXkGQrMiBPixVEFTSBJS
@superuser404notfound
superuser404notfound force-pushed the fix/ae670-fastzap-td-headroom branch from 83547d0 to 623765a Compare September 30, 2026 16:59
@superuser404notfound superuser404notfound changed the title fix(live): fastZap seals headroom over the GOPs it cuts (#670) fix(live): fastZap seals headroom over the GOPs it cuts Sep 30, 2026
@superuser404notfound
superuser404notfound merged commit 0d3dc68 into main Sep 30, 2026
4 checks passed
@superuser404notfound
superuser404notfound deleted the fix/ae670-fastzap-td-headroom branch September 30, 2026 17:42
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