fix(live): recover rerouted ingest sessions in-engine and remember the #168 carriage verdict#200
Merged
Merged
Conversation
…#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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
HLSPlaylistTrackerMEDIA-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 itsingestStalledterminal. Isolated stale-CDN-edge regressions do not trip it, and regressions never feed the stall counter.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.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-DISCONTINUITYseam) instead of delegating to host retune. Exhaustion (attempt cap or barren cycles) halts production and surfacesliveSourceResetas the last resort. Host-provided custom readers and demuxed-audio companion sessions keep the immediate host-retune contract.Verification
HLSPlaylistTrackerTests), verdict memory record/TTL/LRU/refresh, direct-route gating, reopen-transport decision, fresh-reader factory roles (Issue199RerouteRecoveryTests);shouldHaltLiveProductionreopenable semantics extended (LiveProductionHaltTests). All watched fail first.swift build -Xswiftc -strict-concurrency=completeclean, tvOS Simulator build succeeded.🤖 Generated with Claude Code
https://claude.ai/code/session_01NAPCg4tCDdSqkK6tPkNptw