Keep the loopback source window at most 64 MiB ahead of real consumer demand until first frame, then restore the normal full cache high-water policy. This prevents head/tail/midpoint MKV probes from competing with a cache-filling speculative stream and evicting startup bytes. Blocked demand always overrides the limit, so this is not a download quota and cannot strand the reader. Adds focused policy coverage. Syntax parsing passes; full Xcode/tvOS compilation and physical Apple TV validation remain required because no reachable Xcode builder is available in this environment.
Summary
Bound SiloPlayer's speculative origin-stream lead to 64 MiB ahead of actual consumer demand until first frame, then immediately restore the normal cache high-water policy.
This targets avoidable tvOS startup work on large remote MKV files while preserving the existing client-side Dolby Vision Profile 7 → Profile 8.1 transform and steady-state buffering behavior.
Important
This PR is a review draft in
blurbery/silo-apple. It is not deployed to an Apple TV, not submitted toSilo-Server/silo-apple, and does not change the installed TestFlight/App Store build.Production evidence
The measured playback was an 81.3 GB, 4K HEVC, Dolby Vision Profile 7, TrueHD 7.1 MKV using Protocol V3's
client_dv7_to_dv81transformation./api/v1/playback/startThe Apple source cache allows a 256 MiB loopback window on non-constrained devices. During startup,
startPrefetchcreates the sequential origin stream before the segment writer finishes its latency-sensitive Matroska index work. The window can therefore approach its full cache budget while head/tail/midpoint chunk probes occupy the same cache and network path.Note
The eviction/re-anchor explanation is an evidence-backed inference: the byte-zero stream stopped near the source-cache high-water mark, probe chunks arrived concurrently, and the next long-lived request restarted around byte 32.6 MB. Device-side
[CMP-SOURCE-CACHE]logs are still required to prove the exact cache eviction sequence.Root cause
The origin window's existing pause policy considers the global cache budget and blocked demand, but has no startup-specific bound on how far speculative transfer may lead real consumption. That is desirable after playback is established, when a large forward cache provides outage protection. It is counterproductive while the VOD planner is still probing metadata and has not produced the first local HLS fragment.
The result can be:
Implementation
maximumAheadBytesinput to the pure origin-stream pause policy..siloPlayerLoopbacksource proxies.Warning
This is not a 64 MiB download cap. It is a moving lead window. If the demuxer consumes byte N, the origin may continue up to roughly N + 64 MiB; a blocked read always resumes the stream immediately.
Caution
Do not merge upstream or distribute a build until the compile and validation checklist below is complete. The configured remote Xcode builder was unreachable from the current environment, and the local Mac has Command Line Tools only with a mismatched Swift SDK/toolchain.
Validation completed
git diff --checkpassed.Validation still required
Silo.xcodeprojwith XcodeGen.SiloTVscheme against a tvOS 26 SDK.PlaybackOriginStreamPolicyTestson a tvOS simulator.[CMP-TTFF]and[CMP-SOURCE-CACHE]logs for at least five cold starts before and after.Acceptance criteria
Tip
Treat this as successful only if median and p95 TTFF improve without increasing the post-start rebuffer rate. One fast start is not sufficient evidence.
Suggested comparison fields:
Risk and rollback
Privacy and security