Repository navigation
fix(demux): the index pass is not playback, so it keeps the head (AE#585) - #596
Merged
Merged
Conversation
…585) A warmed session re-downloaded its whole warm head. The open phase ends at probeStreams, the next thing the native path does is the cue prewarm (a bounded seek to the middle of the title for the container's index), and #281's drop rule fired on that read: not at the head, so playback must have moved away. It had not. Step 6 resets the cursor to zero immediately afterwards, and playback's first read then paid for bytes the warm already held. The rule's premise is the read being playback's. The index pass says it is not, and the rule stands unchanged around it: AVIOReader holds resident spans while indexPassActive, HLSVideoEngine brackets from decideCompositionOffsetRepair to the cursor reset, and AVIOProvider's default is a no-op so no other provider changes behaviour. Measured on a 46,738,174 B MKV (Cues at the end) over a Range-logging origin at 50 ms per response header, aetherctl play --prewarm: before 5 requests, 50,334,221 B fetched bytes=8388608-41943039, then bytes=0-4194303 and bytes=4194304-8388607 after 3 requests, 41,945,613 B fetched, the two re-fetches gone The line that could not appear before now does: "retained file head served playback's first read at 752; no reconnect for it". Cold control without a warm is unchanged, 3 requests on both arms, same shape. Pinned in Issue585IndexPassKeepsTheHeadTests: the prewarm's seek does not release the head, and the release works again once the pass has ended. 3325 tests green on both runners, iOS-Sim and tvOS-Sim BUILD SUCCEEDED. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_014AVNwe8YDG9EQM7uHdjT3f
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_014AVNwe8YDG9EQM7uHdjT3f
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.
A warmed session re-downloaded its whole warm head, which was the one remaining cost between a warmed session and a cold one.
The shape
The reader's open phase ends at
probeStreams, and the very next thing the native path does is the cue prewarm: a bounded seek to the middle of the title so libavformat loads the container index. That read lands outside the retained head, so #281's drop rule fired on it, on the premise that playback had either moved beyond the head or started nowhere near it. Neither was true. Step 6 resets the cursor to zero immediately afterwards, and playback's first read then paid a fresh connection for bytes the warm already held.The change
The premise is the read being playback's, so the index pass says it is not, and the rule stands unchanged around it.
AVIOReaderholds resident spans whileindexPassActive, and releases them exactly as before outside it.HLSVideoEnginebrackets fromdecideCompositionOffsetRepairto the step 6 cursor reset, both of which already run only for a non-live session.AVIOProvider'sbeginIndexPass/endIndexPassdefault to no-ops, so the custom-reader bridge and every other provider are untouched.Measurement
46,738,174 B MKV with Cues at the end, served by a Range-logging origin with 50 ms before every response header,
aetherctl play --prewarm --seconds 12:The two that disappear are
bytes=0-4194303andbytes=4194304-8388607, the warm head a second time. The line that could not appear before now does:Cold control, same fixture without
--prewarm: 3 requests on both arms, same shape, so nothing changes where there is no warm to keep.Tests
Issue585IndexPassKeepsTheHeadTestspins both halves: the prewarm's seek does not release the head, and the release works again once the pass has ended. The second one fails if the bracket is left open, which is the way this change could quietly cost footprint instead of saving round trips. 3325 tests green on both runners, iOS-Sim and tvOS-Sim BUILD SUCCEEDED.Reported in #585.
🤖 Generated with Claude Code
https://claude.ai/code/session_014AVNwe8YDG9EQM7uHdjT3f