Skip to content

fix(live): recover rerouted ingest sessions in-engine and remember the #168 carriage verdict#200

Merged
superuser404notfound merged 1 commit into
mainfrom
fix/ae199-reroute-recovery
Jul 23, 2026
Merged

fix(live): recover rerouted ingest sessions in-engine and remember the #168 carriage verdict#200
superuser404notfound merged 1 commit into
mainfrom
fix/ae199-reroute-recovery

Conversation

@superuser404notfound

Copy link
Copy Markdown
Owner

Fixes the #199 reroute-recovery cycle: a #168-rerouted live session that lost its ingest tore down into a host retune that relanded on the deterministically doomed native bypass, re-paying the full mount plus watchdog grace every ~13s lap (kskchaitanya1993's deep-window trace).

Three layers

  1. HLSPlaylistTracker MEDIA-SEQUENCE reset rejoin. Three consecutive refreshes whose whole window sits behind the cursor (encoder restart, looped test pool) rejoin at the new edge with a discontinuity seam instead of starving the reader into its ingestStalled terminal. Isolated stale-CDN-edge regressions do not trip it, and regressions never feed the stall counter.
  2. RerouteVerdictMemory. Bounded (32), expiring (6h) memory of master URLs whose video-carriage watchdog fired. load() consults it under the exact watchdog gates (live + fallback enabled) and routes remembered cases straight onto the live-ingest loopback. A host retune after an ingest death now relands on the working path immediately.
  3. In-engine reopen transport for engine-created ingest readers. HLSLiveIngestReader.makeFreshMainReader() vends a fresh reader (immutable URL + headers); live pump exits (eof/readError/keyframeStarvation) run through the existing bounded reopen machinery (Demuxer.open(reader:), continuation indices, EXT-X-DISCONTINUITY seam) instead of delegating to host retune. Exhaustion (attempt cap or barren cycles) halts production and surfaces liveSourceReset as the last resort. Host-provided custom readers and demuxed-audio companion sessions keep the immediate host-retune contract.

Verification

  • New tests: MSN-reset rejoin threshold/stale-edge/stall-isolation (HLSPlaylistTrackerTests), verdict memory record/TTL/LRU/refresh, direct-route gating, reopen-transport decision, fresh-reader factory roles (Issue199RerouteRecoveryTests); shouldHaltLiveProduction reopenable semantics extended (LiveProductionHaltTests). All watched fail first.
  • Full suite green (965 tests, 159 suites), swift build -Xswiftc -strict-concurrency=complete clean, tvOS Simulator build succeeded.

🤖 Generated with Claude Code

https://claude.ai/code/session_01NAPCg4tCDdSqkK6tPkNptw

…#168 carriage verdict (#199)

A #168-rerouted live session that lost its ingest (looped-pool
MEDIA-SEQUENCE reset, CDN gap past the retry budget, encoder restart)
tore down into a host retune that relanded on the native bypass, which
is deterministically doomed for the same master, so the session cycled
reroute -> death -> retune roughly every 13s (kskchaitanya1993's
deep-window trace on #189/#199).

Three layers:
- HLSPlaylistTracker: three consecutive whole-window MEDIA-SEQUENCE
  regressions rejoin at the new edge with a discontinuity seam instead
  of starving the reader into its ingestStalled terminal.
- RerouteVerdictMemory: bounded, expiring memory of masters whose video
  carriage watchdog fired; load() routes remembered cases straight onto
  the live-ingest loopback, skipping the doomed native mount and its
  watchdog grace.
- In-engine reopen transport for engine-created ingest readers: live
  pump exits rebuild a fresh HLSLiveIngestReader through the session's
  existing reopen machinery (bounded, discontinuity seam) instead of
  delegating to host retune; exhaustion still surfaces liveSourceReset
  as the last resort. Host-provided custom readers and demuxed-audio
  companion sessions keep the immediate host-retune contract.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NAPCg4tCDdSqkK6tPkNptw
@superuser404notfound
superuser404notfound merged commit c9a6aeb into main Jul 23, 2026
3 checks passed
@superuser404notfound
superuser404notfound deleted the fix/ae199-reroute-recovery branch July 23, 2026 03:18
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