Measured while fixing AE#551 round 2 (PR #584), on a 63 MB MKV served by a Range-logging origin.
A warm adopts an 8 MB head, and AVIOReader keeps that span past the parse on purpose (#281 retest: "the head has now done the job it was kept past the parse for"). The drop rule is the first read that lands outside it:
if !openPhaseActive, !headSpan.isEmpty, spanPos < 0 || spanPos >= Int64(headSpan.count) {
headSpan = Data()
}
The open phase ends at probeStreams, and the very next thing the native path does is HLSVideoEngine's cue prewarm: a seek to the middle of the title. That read is outside the head, so it drops the span. Playback's first read then goes BACKWARD to the head of the file (the anchored connection sits at the end after a trailing-index parse), and the bytes the warm paid for are fetched again:
3792ms REQ bytes=8388608-41943039 <- pump, starting at the warm frontier
3895ms REQ bytes=0-4194303 <- re-fetching the warm head
4085ms REQ bytes=4194304-8388607 <- and the rest of it
8 MB re-downloaded per session on this path, and the whole warm head is spent on nothing but the parse. The same shape is in the pre-fix log, so this is not from PR #584; the warm just makes it easy to see, and it is the one remaining cost between a warmed session and a cold one.
The rule reads "playback has either moved beyond it or started nowhere near it", and neither is true here: the read that drops it is index work, not playback, and it is followed immediately by a read at offset zero. Worth deciding whether the phase that may drop resident spans should end after the index pass rather than after probeStreams, since the cue prewarm is bounded and known-short.
Measured while fixing AE#551 round 2 (PR #584), on a 63 MB MKV served by a Range-logging origin.
A warm adopts an 8 MB head, and
AVIOReaderkeeps that span past the parse on purpose (#281 retest: "the head has now done the job it was kept past the parse for"). The drop rule is the first read that lands outside it:The open phase ends at
probeStreams, and the very next thing the native path does isHLSVideoEngine's cue prewarm: a seek to the middle of the title. That read is outside the head, so it drops the span. Playback's first read then goes BACKWARD to the head of the file (the anchored connection sits at the end after a trailing-index parse), and the bytes the warm paid for are fetched again:8 MB re-downloaded per session on this path, and the whole warm head is spent on nothing but the parse. The same shape is in the pre-fix log, so this is not from PR #584; the warm just makes it easy to see, and it is the one remaining cost between a warmed session and a cold one.
The rule reads "playback has either moved beyond it or started nowhere near it", and neither is true here: the read that drops it is index work, not playback, and it is followed immediately by a read at offset zero. Worth deciding whether the phase that may drop resident spans should end after the index pass rather than after
probeStreams, since the cue prewarm is bounded and known-short.