Skip to content

fix(live): fastZap ingest joins the cushion it seals, and the ingest honours the request budget (AE#678) - #679

Merged
superuser404notfound merged 2 commits into
mainfrom
fix/fastzap-ingest-budget
Sep 30, 2026
Merged

superuser404notfound merged 2 commits into
mainfrom
fix/fastzap-ingest-budget

Conversation

@superuser404notfound

Copy link
Copy Markdown
Owner

Fixes #678.

What changes

  1. Ingest join covers the loopback cushion. On an ingest, the served TARGETDURATION is floored by the longest upstream segment (ceil(longest / 1.5)). The join used to cover only max(8, 1.5 x advertised TD), which is always a little short of the 3 x TD holdback the first serve waits for. It now covers that holdback plus one GOP, capped at 4 s. With 10 s segments this means joining 3 segments instead of 2.
  2. The ingest respects OriginRequestBudget. Every playlist, segment and key fetch now takes a ticket and reports refusals and redirects. The prefetch window shrinks to the origin's limit, and a direct .custom(HLSLiveIngestReader) load registers the host's ceiling on its playlist URL.
  3. Known HLS URLs skip the raw probe. A live URL whose path ends in .m3u8/.m3u, or that has already taken the AE#363 reroute in this process, goes straight onto the ingest.
  4. The display-criteria "unchanged" skip checks the display manager. Before skipping, it reads preferredDisplayCriteria back and writes again if the host cleared it.
  5. New [Demuxer] open timings log line. It splits connect / open_input / find_stream_info, including when the stream analysis fails.
  6. Doc fix for LoadOptions.probesize. The documentation claimed a probe budget that is too tight always fails open. That is wrong when no stream resolves.

Measured

Setup: hlsfixture --segments-dir serving 10 s segments with a 1 s GOP, window 6, driven by play --live --fast-zap. The two arms alternated within each repeat, 3 runs per arm and row.

origin main this branch
loopback join 2, 19 s < 21 s holdback, bounded start after 1.0 s grace, first picture t+2.27..2.28 s join 3, 21 s >= 21 s, full cushion, t+0.20..0.22 s
proxy, 50 ms, 40 Mbit/s shared t+4.10..4.14 s t+2.82..2.83 s
proxy refusing a 2nd concurrent request with 429, --max-concurrent-requests 1 peak inflight 2, two 429 per zap peak inflight 1, no refusal
same with 403 fails 3/3: [HLSIngest] terminal: playlistUnreachable(403) then probe failed (Demuxer: stream info failed (Operation not permitted (-1))), the reporter's exact line plays 3/3, t+3.54..3.71 s, raw probe skipped

On the 403 proxy the branch still starts through the bounded grace (9 s < 21 s). With serial fetches, the third 10 s segment arrives after the 1 s grace, so the window is shallow at start. No CoreMedia errors in any run.

swift test: XCTest 655 tests, swift-testing 3942 tests, 0 failures.

Not verifiable on macOS: the display-criteria read-back (tvOS only) still needs a device check. If tvOS nils preferredDisplayCriteria on its own, the new log line criteria were cleared outside the engine will show up on every zap in Sodalite, which never clears it itself.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WJcXkGQrMiBPixVEFTSBJS

Vincent Herbst and others added 2 commits September 30, 2026 21:42
…st honours the origin request budget (AE#678)

The served TARGETDURATION on an ingest is floored by the longest upstream segment
(ceil(longest / 1.5), AE#447), so a 10 s provider seals TD 7 and the first serve wants 21 s.
The join covered max(8, 1.5 x advertised TD), two 10 s segments, 19 s cut once the last GOP
stays open: short by construction for every segment above ~5 s, so every fastZap zap ended at
the bounded start's grace. The join now covers that holdback plus one GOP (bounded at 4 s).

HLSLiveIngestReader charged nothing to OriginRequestBudget and fetched four segments in
parallel, so maxConcurrentSourceRequests = 1 meant four connections to a single-connection
provider. Every playlist, segment and key fetch now takes a ticket, notes refusals and
redirects, and the prefetch window narrows to the origin's limit. A direct .custom ingest load
registers the declared ceiling on the playlist URL.

Measured, hlsfixture 10 s segments / 1 s GOP behind a proxy (50 ms, 40 Mbit/s shared),
play --live --fast-zap, 3 runs per arm:
- loopback: first picture t+2.24..2.52 s -> t+0.22 s, full cushion instead of bounded start
- 40 Mbit/s: t+4.11..4.39 s -> t+2.87..2.90 s
- single-connection proxy, --max-concurrent-requests 1: peak inflight 2 and two 429 per zap
  -> peak inflight 1, no refusal

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WJcXkGQrMiBPixVEFTSBJS
… host are written again, and every open states its timings (AE#678)

- A live URL with a .m3u8/.m3u path, or one that already took the AE#363 route in this process,
  goes straight onto the ingest instead of spending a discarded raw request per zap.
- DisplayCriteriaController reads preferredDisplayCriteria back before the unchanged skip, so a
  host that cleared it itself (leaving full screen) gets its frame rate on the next same-format
  load instead of the UI mode.
- [Demuxer] open timings: connect / open_input / find_stream_info / total, stream count and probe
  budget, also when the stream analysis fails.
- LoadOptions.probesize no longer claims an over-tight budget always fails open.

Measured against a proxy that answers a second concurrent request with 403 (--max-concurrent-requests 1,
10 s segments, 40 Mbit/s): main fails 3 of 3 zaps with the reporter's exact line, 'probe failed
(Demuxer: stream info failed (Operation not permitted (-1)))' after '[HLSIngest] terminal:
playlistUnreachable(403)'; this branch plays 3 of 3 at t+3.54..3.71 s with peak inflight 1.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WJcXkGQrMiBPixVEFTSBJS
@superuser404notfound
superuser404notfound merged commit 5f97e19 into main Sep 30, 2026
4 checks passed
@superuser404notfound
superuser404notfound deleted the fix/fastzap-ingest-budget branch September 30, 2026 20:08
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.

fastZap on an HLS ingest with long upstream segments always ends at the bounded start: the join is shorter than the holdback it seals

1 participant