Repository navigation
fix(live): the carriage probe spends playlists against the mount, and a segment only after it - #297
Merged
superuser404notfound merged 1 commit intoAug 4, 2026
Conversation
… a segment only after it The #293 probe reads the head of the first segment to classify its PMT, and it starts that read in `load`, concurrently with the native mount of the same stream. Origins that authenticate per token routinely cap concurrent connections at one or two, and what such a cap counts is media fetches, not playlist fetches. The shapes the probe's gate admits, an fMP4-only advertised codec or no master evidence at all, are exactly the live channels where that cap bites, so the probe could take the slot the mount needed and land as an intermittent failure to start on the channels it exists to speed up. Neither defect behind that is "the probe reads a segment". It reads one where the playlists already answer. An fMP4 media segment requires an EXT-X-MAP (RFC 8216 4.3.2.5), so a master that advertises hvc1/hev1/dvh1/dvhe/av01 over a window that carries no EXT-X-MAP is that codec in MPEG-TS, settled from a `CODECS` attribute AVFoundation has already parsed plus one playlist fetch. `HLSCarriageProbe.classifyFromPlaylists` settles that case outright now, and AES-128 no longer blocks it: the PMT is not what is being read there, the ingest decrypts that carriage, and the alternative for those channels was the full grace ending in the same reroute. And it reads it at the one moment where losing the race is expensive. The verdict cannot be acted on before readyToPlay in any case, because it feeds the watchdog and the watchdog arms there, so running the read against the mount buys nothing but a head start on the probe's own latency. What is left after the playlist stage, a direct media playlist or a master without CODECS, is where the PMT is the only evidence that separates HEVC in MPEG-TS from H.264 in MPEG-TS, and dropping that distinction would either pull working H.264 channels off the native path or return the case to indefinite black. That read now waits for readyToPlay, where a lost connection can only cost the verdict on a session that is already showing black, and a session whose watchdog disarms first, or which never becomes ready at all, spends no media byte. Media connections per channel shape: an advertised HEVC/DV/AV1 master goes from one to none, an AES-128 one from none-and-inconclusive to none-and-settled, a direct media playlist keeps its one but no longer spends it against the mount, and an H.264 master still spends nothing. The saving stays about 3.5 s of the 4 s grace, since the deferred verdict lands inside the first tick or two. Verify: `Issue296CarriageProbeConnectionBudgetTests`, 14 tests, all watched failing first, pinning the playlist evidence rules and asserting on the origin's request log that no segment is fetched where the playlists settle it. Full suite green (463 XCTest, 1479 swift-testing), tvOS Simulator build clean. Raised by @kskchaitanya1993 on #293 after the device leg, as a design concern against connection-capped IPTV origins rather than a reproduction. Part of #296, which stays open for the device leg. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01HX5zV3Fcf7Nzq4DYGdXvQE
superuser404notfound
force-pushed
the
fix/296-carriage-probe-connection-budget
branch
from
August 4, 2026 04:15
d0082ce to
d157a70
Compare
superuser404notfound
deleted the
fix/296-carriage-probe-connection-budget
branch
August 4, 2026 04:27
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.
Part of #296. The issue stays open for the device leg on a real connection-capped origin.
The #293 probe classifies a live source's carriage from its playlist and the head of its first segment. That segment read starts in
NativeAVPlayerHost.load, concurrently with the native mount, and on an origin that caps concurrent connections per token (the IPTV norm, one or two) it is a second media connection competing with the mount. Playlist fetches are generally not what such caps count. The shapes the gate admits, an fMP4-only advertised codec or no master evidence at all, are precisely the channels where the cap bites, so this could land as an intermittent failure to start on the channels the probe exists to speed up, and it would read as a flaky origin rather than as the probe.Two defects, neither of which is "the probe reads a segment".
It reads one where the playlists already answer. An fMP4 media segment requires an
EXT-X-MAP(RFC 8216 4.3.2.5). A master advertisinghvc1/hev1/dvh1/dvhe/av01over a window with noEXT-X-MAPis therefore that codec in MPEG-TS, settled from aCODECSattribute AVFoundation has already parsed plus one playlist fetch.HLSCarriageProbe.classifyFromPlaylistssettles that outright now. AES-128 no longer blocks the branch either: the PMT is not what is being read there, the ingest decrypts that carriage, and the alternative for those channels was the full grace ending in the same reroute.It reads it at the one moment where losing the race is expensive. The verdict cannot be acted on before
readyToPlayregardless, since it feeds the watchdog and the watchdog arms there. Running the read against the mount buys nothing but a head start on the probe's own latency. What survives the playlist stage, a direct media playlist or a master withoutCODECS, is where the PMT is the only evidence separating HEVC in MPEG-TS from H.264 in MPEG-TS: dropping it would either pull working H.264 channels off the native path or return that case to indefinite black. So the read stays, and waits forreadyToPlay, where a lost connection can only cost the verdict on a session that is already showing black. A session whose watchdog disarms first, or which never becomes ready, now spends no media byte at all.Media connections per channel shape:
EXT-X-MAPCODECSreadyToPlayThe saving stays about 3.5 s of the 4 s grace: the deferred verdict lands inside the first tick or two.
Verification
Issue296CarriageProbeConnectionBudgetTests, 14 tests, all watched failing first. They pin the playlist evidence rules (advertised fMP4-only codec,EXT-X-MAP, AES-128 vs SAMPLE-AES, an empty window, noCODECS) and assert on the origin's request log that no segment is fetched where the playlists settle it. Full suite green: 463 XCTest (1 skipped) plus 1479 swift-testing. tvOS Simulator build clean.Raised by @kskchaitanya1993 on #293 after the device leg, as a design concern against connection-capped origins rather than a reproduction.