You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(startup): overlap DV probe, prefetch MKV Cues from SeekHead, and defer subtitle prefetch - #31
Cuts cold-start latency for HTTP playback by running Dolby Vision capability probes concurrently, prefetching Matroska Cues from SeekHead entries during open, kicking off the HLS background index pass before the composition-offset probe, tightening progressive-delivery segment waits, and deferring subtitleForwardPrefetcher until the session is ready.
What changed
VTCapabilityProbe: probes Dolby Vision hardware decode profiles concurrently instead of sequentially on cold launch.
AVIOReader: parses Matroska SeekHead entries out of the opening bytes and prefetches trailing Cues in parallel so cue prewarm hits RAM instead of cancelling the initial bytes=0- stream on large MKV remuxes.
HLSVideoEngine: starts beginIndexPass() before decideCompositionOffsetRepair() so packet indexing overlaps with the repair check.
SegmentCache: shortens the progressive-delivery wait step so ready segment fragments surface sooner.
AetherEngine+Subtitles: holds subtitleForwardPrefetcher until isSessionReady so background subtitle harvesting does not compete for demuxer lock and bandwidth before first frame.
aetherctl: adds --probesize and --max-analyze-duration flags to play (documented in docs/cli.md) to exercise existing LoadOptions.probesize and LoadOptions.maxAnalyzeDuration budgets.
CHANGELOG.md: records the Silo fork startup improvements under [Unreleased].
Test plan
Device / OS: macOS (SwiftPM test runner), iOS and tvOS physical devices (signed Silo client builds)
Source media (container / video codec + profile / audio / HDR-DV): 4K MKV remux (HEVC Dolby Vision Profile 8.1, TrueHD/AC-3, 36 embedded PGS tracks, trailing Cues ~2 MB before EOF) and 1080p SDR MKV remux (H.264, DTS/AC-3)
Result: swift test targeted suites passed (43/43 tests in 4 suites including PublicAPIDocumentationTests, DocumentedConstantsTests, Issue281ColdStartRoundTripTests, StartAfterCuePrewarmTests, Issue151SubtitleForwardPrefetchTests, SourcePrewarmPlanTests, plus earlier 66/66 run including FabricatedRangeOriginTests, Issue240SideReaderLinkPriorityTests, Issue295RangeBoundaryRefetchTests); Scripts/check-doc-links.py passed; signed iOS and tvOS builds compiled and played back cleanly.
The fix lives in the engine, not in a host-side workaround
Public API changes are intentional and documented
Council review
Rounds: 3, last reviewed at the round-2 fix head; round-3 fixes end at 2556b01e.
Member
Round 1
Round 2
Round 3
Sol (gpt-6.2-sol, medium)
5/10
8/10
8/10
Opus (claude-opus-5-5, medium)
5/10
8/10
8/10
Gemini (gemini-4-neon, medium)
5/10
9.5/10
8/10
Visual review: not run; nothing changes on screen. Fixed in review: verdict cache keeps supported verdicts only, trailing Cues prefetch only for the playback demuxer, suffix completion timed from its own start, trailing span validated, CHANGELOG corrected. Round 3: the tail prefetch takes the superseded slot before cancelling it, the suffix span installs only for the current request at the open's size (published under the reader's lock), and the poll is back to 20 ms.
AI Disclosure: Harness: Antigravity (T3 Code); Tool(s): T3 Code, Antigravity agent; Model(s): gemini-4-neon; Involvement: AI-assisted; Adversarial review: see Council review above; review fixes by Claude Code (claude-opus-5-5) in T3 Code.
Note
Overlap DV probe with MKV Cues prefetch and defer subtitle prefetch at startup
Speeds up cold-start playback by parsing the Matroska SeekHead and prefetching the trailing Cues span in parallel with the DV capability probe, instead of waiting for a sequential index pass. AVIOReader gains a prefetchesTrailingIndex flag (default false), enabled via DemuxerOpenProfile.prefetchingTrailingIndex() for playback opens in HLSVideoEngine.swift and AetherEngine.swift
The trailing prefetch takes over the suffix-prefetch's origin-request slot via a new OriginRequestBudget.Ticket.take method in OriginRequestBudget.swift, and is capped at 4 MiB. Superseded completions are fenced with a generation counter
The startup index-pass bracket now covers the composition-offset repair, so a head packet read during repair cannot drop the retained head span before cue prewarm completes
Adds a 64-entry synchronized cache of accepted VideoToolbox hardware-decode verdicts in VTCapabilityProbe.swift; refused verdicts are not cached. Defers the native subtitle side-demuxer open up to 8 seconds until the session is ready, with polling at 150 ms
Adds --probesize and --max-analyze-duration flags to aetherctl play for measuring startup time, documented in cli.md
Risk: readers adopting a warm tail span or opened without the prefetch flag skip Matroska trailing inspection; a tail span whose end differs from a resolved file size is discarded — check AVIOReader teardown and size-probe paths in AVIOReader.swift
The changes add optional Matroska trailing-index prefetching for playback, adjust playback index and subtitle-prefetch timing, cache successful hardware-decode verdicts, and expose probe-size and analysis-duration options in aetherctl play.
Playback profiles can enable trailing-index prefetching. AVIOReader inspects retained Matroska head data and fetches eligible trailing ranges. The reader validates tail spans and fences stale completions. Tests cover Cues reads, request limits, and disabled prefetching.
Playback preparation and prefetch timing Sources/AetherEngine/Video/HLSVideoEngine.swift, Sources/AetherEngine/AetherEngine+Subtitles.swift
The HLS index pass starts before composition-offset repair. Subtitle forward prefetch waits for initial-session readiness, with the existing deadlines and arbitration condition retained.
Successful verdicts are cached by codec, dimensions, and configuration bytes. The cache is lock-protected and holds up to 64 entries. Refusals are not cached.
aetherctl play accepts --probesize and --max-analyze-duration and passes supplied values to LoadOptions. The CLI documentation and changelog describe these options.
sequenceDiagram
participant PlaybackDemuxer
participant AVIOReader
participant HTTPOrigin
PlaybackDemuxer->>AVIOReader: Open with trailing-index prefetch enabled
AVIOReader->>AVIOReader: Inspect retained head for a Matroska trailing object
AVIOReader->>HTTPOrigin: Request eligible trailing byte range
HTTPOrigin-->>AVIOReader: Return requested range
AVIOReader-->>PlaybackDemuxer: Serve reads from the fetched tail span
Loading
Suggested reviewers:pkajaba
Security architecture risk: Moderate · up to 8fc15
The faster Matroska startup path intentionally spends a bounded request to avoid interrupting playback’s initial stream. AetherEngine can spend that request before it knows whether the selected playback route needs it, and a replacement fetch can bypass an origin’s active backoff. Separately, a previously successful hardware check can turn a later HEVC load into a playback failure instead of allowing software decoding.
Minor · reliability · observed: AVIOReader treats the suffix request’s lease as permission to send a new trailing-index request. If the origin enters a Retry-After quiet period or exhausts its pacing tokens while the suffix is outstanding, a successful lease transfer skips the checks that would reject a fresh speculative request. The single-slot guard only stops an origin currently limited to one request; the pacing check runs only when no suffix lease can be taken. The merge base had no replacement request that could cross that backoff boundary.
Trivial · architecture · observed: AetherEngine opts the initial probe into the larger SeekHead fetch before selecting the playback route. An eligible HTTP Matroska open can consume a request slot and fetch up to 4 MiB even if the selected route does not use HLS cue prewarm. That cost is useful when the route consumes the prefetched bytes; it is new relative to the base’s smaller suffix fetch when the route does not. The declared-sequential path and the known single-slot guard skip the request, and fresh admission can refuse it, but none of those checks confirms that a consumer will use the bytes.
Minor · reliability · inferred: SoftwarePlaybackHost uses a cached HEVC success to select hardware even if VideoToolbox availability has changed since that success. The real decoder open still checks current availability, but the host only falls back at open for VP9. A matching HEVC load can therefore fail where a fresh probe refusal in the base would have selected libavcodec. The open failure does not invalidate the cached success, so repeating the load can repeat the same decision.
inferred — The new network exposure is source availability: an eligible media open can issue one bounded trailing request, and admission and backoff are shared with other readers using the same origin budget. The media metadata does not grant authority to choose a new host.
Public contracts
observed — aetherctl play adds optional byte and microsecond probe-budget overrides through existing LoadOptions fields. The trailing-fetch option is internal to Demuxer and AVIOReader.
Resilience and Maintainability Implications
observed — The lease and generation checks prevent double release and stale buffer installation. If fresh admission is refused after cancellation, AVIOReader clears the wait state, does not restore the suffix fetch, and leaves reads to the ordinary path. In a successful handoff, the lease moves before the suffix completion callback; it proves local slot ownership, not that the provider has acknowledged cancellation or retired its work.
observed — VideoToolbox refusals are not cached, so a retry after a fresh negative probe can reach VideoToolbox again. A cached positive takes a different path: SoftwarePlaybackHost discovers any current refusal at decoder open, where the HEVC path propagates failure without the VP9 software fallback.
Hardening Proposals
proposed — Separate concurrency-slot transfer from permission to start a new HTTP request. Apply current pacing before cancelling the suffix, and verify the handoff against an origin fixture that enforces both request backoff and its concurrency cap.
Rollout and rollback
observed — AetherEngine’s open profile enables the optimization before route selection. For a provider that genuinely requires unranged sequential reads, the integration must declare that source policy before opening; AVIOReader then takes the forward-only path. Otherwise, AVIOReader checks for a known single-slot origin at trailing-request initiation. That guard prevents speculation at one slot, but it does not enforce a multi-slot provider’s backoff after a lease transfer.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names three of the main changes in the changeset: Dolby Vision probe concurrency, Matroska Cues prefetch from SeekHead, and subtitle prefetch deferral. It omits the verdict cache, the HLS in…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Description check
The description is related to the changeset. It names the concurrent Dolby Vision capability probes, Matroska SeekHead Cues prefetch in AVIOReader, the HLSVideoEngine index-pass reordering, the subtit…
Full details: Title check
Explanation
The title names three of the main changes in the changeset: Dolby Vision probe concurrency, Matroska Cues prefetch from SeekHead, and subtitle prefetch deferral. It omits the verdict cache, the HLS index-pass reordering, and the aetherctl flags, but it describes real, central parts of the PR and is not misleading.
Full details: Description check
Explanation
The description is related to the changeset. It names the concurrent Dolby Vision capability probes, Matroska SeekHead Cues prefetch in AVIOReader, the HLSVideoEngine index-pass reordering, the subtitle prefetch deferral, and the aetherctl --probesize and --max-analyze-duration flags. Each of these matches the file-level summaries. The description also gives a test plan and a council review record. The description is specific and on-topic, so it passes this lenient check.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
The reason will be displayed to describe this comment to others. Learn more.
Capture an immutable start time for the suffix completion
When a Matroska range prefetch upgrades an outstanding suffix fetch, this assignment can race with the suffix fetch's completion, which reads tailPrefetchStartedAt outside winCond when calculating elapsedMs. The persistent and chunk sessions use separate delegate queues, so the completion can evaluate DispatchTime.now() before the upgrade captures its new start time, then read that newer timestamp afterward; the unsigned subtraction can consequently underflow and trap during playback startup. Capture the suffix request's own immutable start time in its completion, as the new explicit-range completion already does, rather than reading the mutable shared timestamp.
The reason will be displayed to describe this comment to others. Learn more.
Superseded tail completion can underflow its elapsed-time calculation
A replacement request can overwrite tailPrefetchStartedAt after the current time is sampled, causing unsigned subtraction to trap and terminate playback. Capture each suffix request's start time locally and use it in the completion.
Prompt for LLM
File Sources/AetherEngine/Demuxer/AVIOReader.swift, lines 3539-3541:
Superseded tail completion can underflow its elapsed-time calculation
The suffix completion reads `tailPrefetchStartedAt` without the lock while the replacement request can overwrite it after the current time is sampled, causing unsigned subtraction to trap and terminate playback. Capture the suffix request's start time locally and use that immutable value in its completion.
The reason will be displayed to describe this comment to others. Learn more.
The suffix prefetch blocks its own replacement under a two-request limit
When maxConcurrentSourceRequests is two, playback and suffix prefetch fill both slots, so tryAcquire rejects the larger Cues request. Release or replace the speculative request before acquiring its replacement, and allow retries when no slot is available.
Prompt for LLM
File Sources/AetherEngine/Demuxer/AVIOReader.swift, lines 3608-3610:
The suffix prefetch blocks its own replacement under a two-request limit
With `maxConcurrentSourceRequests` set to two, the playback connection and suffix prefetch occupy both slots, so `tryAcquire` rejects the larger Cues request before the suffix task is canceled and the new startup optimization is lost. Release or replace the existing speculative request before acquiring its replacement, and allow a retry if the slot is temporarily unavailable.
The reason will be displayed to describe this comment to others. Learn more.
Confirmed, not fixed. With a two-request budget the upgrade is skipped and the reader falls back to the suffix prefetch, which is what main does, so nothing breaks. Fixing it properly means handing the suffix's slot to the trailing request, and that slot is released asynchronously; that's new budget accounting, better done on its own.
The reason will be displayed to describe this comment to others. Learn more.
Agreed. Under a two-request budget, the larger Cues prefetch can be skipped while playback and the suffix prefetch hold both slots. Playback falls back to the existing suffix behavior, so this is a missed startup optimization rather than a playback regression.
Handling the asynchronous slot handoff and retry is reasonable as a separate follow-up. Would you like me to create an issue to track it?
The reason will be displayed to describe this comment to others. Learn more.
Transient decoder creation failures become permanent unsupported verdicts
A temporary VTDecompressionSessionCreate failure caches .unsupported for the process lifetime, forcing software decoding even after hardware resources recover. Cache only successful verdicts, or distinguish permanent unsupported-format statuses from transient failures.
Prompt for LLM
File Sources/AetherEngine/Video/VTCapabilityProbe.swift, lines 199-200:
Transient decoder creation failures become permanent unsupported verdicts
A temporary `VTDecompressionSessionCreate` failure is cached as `.unsupported` for the same format for the rest of the process, so subsequent playback continues to take the software route even after hardware resources recover. Cache successful verdicts only, or distinguish permanent unsupported-format statuses from transient failures.
Suggested code:
let verdict: HardwareDecodeVerdict = ok ? .supported : .unsupported
if ok { verdictCache.set(verdict, for: cacheKey) }
The startup optimization makes AetherEngine's existing post-panel-settle retry reuse the refusal it was meant to recheck. In the merge base the retry opened a fresh VideoToolbox session; at head a same-key cache hit skips that check. A refusal recorded during the transition can therefore keep the current load and later matching loads on the software path after the condition has cleared.
The new SeekHead prefetch sends an absolute range calculated from the reader's known file size, but its delegate accepts any end-of-file span of the expected length and installs it at the response-reported offset. A stale or inconsistent source response can replace the resident tail and supply bytes from a different source view to the demuxer. The suffix-only base had the same validator, but this PR applies it to an absolute-range contract and a larger resident span.
The entire 8 MiB fixture fits below the default 16 MiB high-water threshold. The opening connection can therefore deliver Cues into window. Since readPersistent serves window first, the marker and request-count assertions can pass even if the explicit prefetch never installs its span.
Use a larger fixture, such as 64 MiB, with Cues beyond the opening 32 MiB request. Keep the cluster marker inside the retained head. This makes the assertions detect a broken prefetch installation.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 00ba677e-61fb-4253-afeb-2bd2a1efc857
Commits
Reviewing files that changed from the base of the PR and between 1afe480 and 68e3baf.
Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.
The reason will be displayed to describe this comment to others. Learn more.
Independently tested 68e3bafd against 1afe480fcb with a 4K Dolby Vision 8.1 MKV over an isolated HTTP range origin.
Metadata probes now fetch the trailing Cues. Every aetherctl probe invocation on the base made two GETs. The PR made three and downloaded an additional 2,865,183 bytes even though the caller only requested metadata. With a warm origin and a new CLI process for each trial, the median went from 76.6 to 234.5 ms and p95 from 110.4 to 433.5 ms (8 trials per revision). Gate the extra range on an open that intends to use the index for playback or seeking. Prefetch condition
Across two full loads per trial, median origin requests fell from 19 to 17 and interrupted responses from 2 to 0. First frame ready was 350 → 355 ms on process start and 212 → 251 ms on reload (8 each). The PR head also lacks LiveTelemetry.relayMediaReceivedBytes, which the current Apple app requires. Please retain that API when preparing the client pin. silo-apple#1360
AI-assisted validation · Codex (gpt-6.2-sol, xhigh) in T3 Code.
…pted
The new verdict cache also kept refusals for the life of the process.
VideoToolbox refuses for passing reasons, such as no hardware decoder while
the app is in the background, and the AE#348 retry after the panel settles
read the cached refusal back instead of asking again. A format refused once
then stayed on the software path for every later load.
Cache a supported verdict only; a refusal is probed again on every consult.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… demuxer
The SeekHead-guided trailing Cues prefetch ran on every AVIOReader open
with read-ahead on: metadata probes, the Dolby Vision record audit, and
the subtitle and Atmos side demuxers each fetched up to 4 MiB beside their
open that nothing read. Only the session's playback demuxer, whose cue
prewarm reads that index, gains from it.
Gate it on a new open-profile flag that the session's probe demuxer and
HLSVideoEngine's own open set, and test that a reader without it leaves the
trailing range alone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The suffix prefetch's completion read the shared tailPrefetchStartedAt
outside winCond, and the Matroska trailing-range prefetch now rewrites that
field when it supersedes the suffix. A completion that read the later start
subtracted a larger DispatchTime from a smaller one, which traps on UInt64.
Capture the suffix request's start in a local, as the trailing-range path
already does.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sked for
The trailing-range completion installed any span the delegate accepted, and
the delegate only checks that the span is the right length and ends at the
response's own total. A fetch superseded by a close or a forward-only
switch, or an origin answering against a different length, could install
bytes at offsets this open does not own.
Install only for the current prefetch generation, starting at the requested
offset and ending at the size the open knows.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The entry said VTCapabilityProbe checks the Dolby Vision decode profiles
concurrently; the change caches verdicts instead. It now names what each
part does, including that refusals are not cached and that only the
playback demuxer fetches the trailing Cues.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 68e3bafd. New findings are inline; the verdict-cache, suffix start-time, and request-budget threads are answered in place.
For the maintainers: the Silo app pins this engine at f470d8dc, the head of #30, and this branch is based on main, which lacks LiveTelemetry.relayMediaReceivedBytes from #30. The app can't adopt this PR until #30 lands and this branch is rebased, or this branch is rebased onto #30.
The reason will be displayed to describe this comment to others. Learn more.
Maintainer decision. 20 ms → 4 ms means five times the wakeups for every connection waiting on a progressive segment, on battery-powered iPhones and iPads included, and no measurement separates its gain from the rest of the PR. Options: keep 4 ms, go back to 20 ms, or signal readers through the existing condition instead of polling. I'm leaving it as it is.
AetherEngine enables the larger SeekHead fetch on its initial playback probe before choosing the final route. An eligible HTTP Matroska open can therefore spend an origin request slot and fetch up to 4 MiB even if playback later takes a path that does not perform HLS cue prewarm. The base had the smaller suffix fetch but did not pay this cost before route selection. AVIOReader skips the new request for declared sequential sources and checks known serial-origin restrictions and available request slots, but those checks do not establish that a consumer will use the bytes.
SoftwarePlaybackHost treats a cached HEVC success as evidence that hardware is available for the current load. If availability changes after the earlier success, a matching load can select hardware and propagate a decoder-open failure instead of selecting libavcodec as a fresh refusal would have in the base. The actual VideoToolbox open still checks current availability, but the host's open-time software fallback applies only to VP9, and an HEVC open failure does not invalidate the cached positive verdict.
The 8 MiB fixture fits in both the default 16 MiB window and the first 32 MiB pump request. If that request finishes before the Cues read, readPersistent serves the window without using tailSpan. The test can therefore pass when the explicit prefetch is requested but never installed.
Change the fixture layout or reader-window setup so the main window cannot serve Cues. Keep cluster 0 in the retained head. This makes a broken tail installation fail the round-trip assertion.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: f3c39130-97a7-478e-81aa-fba16fbbaca5
Commits
Reviewing files that changed from the base of the PR and between 68e3baf and d4ffca8.
Files skipped from review as they are similar to previous changes: 1
CHANGELOG.md
Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.
The reason will be displayed to describe this comment to others. Learn more.
Major · Stability & Availability · Heavy lift
A cached hardware verdict can select a decoder that VideoToolbox refuses.
A successful probe is cached and reused. A later load that runs while VideoToolbox refuses new sessions, such as in the background, gets the cached .supported. SoftwarePlaybackHost then selects HardwareVideoDecoder without a new probe. That decoder has no software fallback, so the stream can stay without decodable video. Before this change, the same load re-probed, received the refusal, and used libavcodec.
A cached success must not route a load to hardware in a state where VideoToolbox can refuse the session. Choose one of these behaviors: check hardware availability again before using the cached verdict, or fall back to libavcodec when the hardware session fails to open.
Fit: 7/10 · Readiness: 7/10 — conditional (assuming CI is green)
What changed in review
Verdict cache: keeps only supported verdicts, so the retry after the panel settles reaches VideoToolbox again.
Trailing Cues prefetch: runs only for the session's playback demuxer and HLSVideoEngine's open. Metadata probes and side readers no longer fetch the extra ~2.9 MB.
Suffix completion: times itself from its own start, so the unsigned subtraction can't trap.
Trailing span: installed only when the fetch is current, at the requested offset, and ending at the known file size.
CHANGELOG: describes what the code does.
Checks:swift build passes, 76 focused tests pass, and check-doc-links passes.
Progressive poll went from 20 ms to 4 ms (open thread), and the gain is unmeasured.
Two-slot request budget: the trailing request still tries for a slot before cancelling the suffix request, which falls back to main's behavior. Fixing it means handing over the suffix's slot.
The legacy suffix callback still installs its span without a generation check. That code predates this PR.
Council
Member
Round 1
Round 2
Sol (gpt-6.2-sol, medium)
5/10
8/10
Opus (claude-opus-5-5, medium)
5/10
8/10
Gemini (gemini-4-neon, medium)
5/10
9.5/10
Fit is 7: the startup work belongs in the engine, but the poll change trades wakeups for an unmeasured gain. Readiness is 7: the defects found are fixed, and the base-branch question decides when the app can use it.
…d the open's size
The suffix prefetch completion checked the generation but installed its
span anyway, so a suffix the Matroska trailing-index request had
superseded could still land, and a suffix answered against a different
length than the opening GET would be served at the wrong offsets.
Install only for the current generation and only when the span ends at
the size the open knows. When the suffix lands before the data
connection has named a size, the span goes in and is dropped as soon as
a size arrives that it does not end at.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…g request
The trailing-index request asked the origin budget for a slot before it
cancelled the suffix request it supersedes. On an origin capped at two
requests the data connection and the suffix request already hold both,
so the trailing request was always skipped and the Cues were read over a
reconnect.
Supersede the suffix request first and move its slot to the trailing
request (OriginRequestBudget.Lease.take), so the slot never goes back to
the budget where another caller could take it in between. When the
suffix request has already finished, the trailing request asks the
budget as before. A read waiting on the tail keeps waiting across the
handoff.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This PR lowered the progressive segment reader's poll interval from
20 ms to 4 ms without a measurement showing a gain. Restore main's value
and drop the CHANGELOG sentence that described the change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
silo-triageBot
added
size/XL
500–999 added + deleted lines (all files); change volume, not priority.
and removed
size/L
200–499 added + deleted lines (all files); change volume, not priority.
labels
Dec 6, 2026
AVIOReader treats the suffix request’s lease as permission to send a new trailing-index request. If the origin enters a Retry-After quiet period or exhausts its pacing tokens while the suffix is outstanding, a successful lease transfer skips the checks that would reject a fresh speculative request. The single-slot guard only stops an origin currently limited to one request; the pacing check runs only when no suffix lease can be taken. The merge base had no replacement request that could cross that backoff boundary.
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: e8437c54-e6ed-4874-ad03-ccf382e6fbad
Commits
Reviewing files that changed from the base of the PR and between d4ffca8 and 8fc15d4.
Files skipped from review as they are similar to previous changes: 1
CHANGELOG.md
Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Performance & Scalability · Quick win
The Matroska trailing prefetch can lose its origin slot to another caller.
The suffix request releases its budget ticket on every outcome, including cancellation. Here, the code cancels that request before it takes the lease. If the suffix completes in that gap, its release can hand the slot to a queued caller. The lease's take() then returns nil, and the fallback admission fails. The trailing Cues prefetch is skipped, and the reader falls back to a reconnect that adds origin round trips at cold start.
Take the ticket before cancelling the suffix task:
Suggested fix
tailPrefetchTask = nil
tailPrefetchLease = nil
+ // Take the slot before cancelling: the cancelled suffix can release its ticket on the+ // delegate queue at any point after cancel() returns.+ let inheritedTicket = supersededLease?.take()
// `tailPrefetchInFlight` stays as it was across the handoff, so a read already waiting on
// the tail keeps waiting for this request instead of reconnecting in the gap.
winCond.unlock()
supersededTask?.cancel()
- guard let ticket = supersededLease?.take() ?? OriginRequestBudget.shared.tryAcquire(+ guard let ticket = inheritedTicket ?? OriginRequestBudget.shared.tryAcquire(
for: url, label: "\(label) mkv trailing prefetch") else {
The reason will be displayed to describe this comment to others. Learn more.
Minor · Performance & Scalability · Quick win
Check request-rate admission when transferring the slot.
If the armed pacer has two tokens, the suffix request and pump can consume both. When the SeekHead arrives, supersededLease?.take() returns a ticket and bypasses tryAcquire, including its rate-token check. The explicit prefetch then starts without rate admission.
Preserve the concurrency slot, but check and consume a rate token for the replacement request. If no token is available, skip the speculative request. Keep the existing handoff for unpaced origins.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Performance & Scalability · Quick win
Do not finish inspection from an incomplete SeekPosition.
If a delivery ends inside a SeekPosition, SourcePrewarmPlan.seekPositions clamps the field to the available bytes and accepts that shorter integer. For a 2 GiB MKV with Cues 512 KiB before EOF, seven bytes of an eight-byte position can produce an offset near 8 MiB. This line then finishes inspection, while the incorrect trailing length fails the 4 MiB cap. Later bytes cannot trigger the valid Cues prefetch.
Require the complete SeekPosition payload before accepting its value. Keep inspection pending within the existing inspection bound when the field is incomplete.
The trailing-index request cancelled the suffix request before taking
its lease. A cancel can fire the suffix delegate's completion, which
releases the lease, so the slot could go back to the origin budget and
be taken by another caller before the handoff ran.
Take the lease first, then cancel. The suffix completion's release then
finds nothing to return, and the trailing request asks the budget only
when there was no slot to take over.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
When the data connection named no size, the open fell back to the size
probe and wrote the result to fileSize without holding winCond, then
took the lock only to check the tail span. The suffix prefetch's
completion reads fileSize under winCond to decide whether its span fits,
so the two raced.
Probe into a local and publish it in the same critical section as the
tail check. The refused-at-offset-0 branch, which resets the size to
unknown while the suffix request can still be in flight, now writes
under the lock too.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fit: 7/10 · Readiness: 8/10 — conditional (assuming CI is green)
What changed since the last summary
Tail prefetch handoff. The trailing-index request takes the superseded suffix request's origin slot before cancelling it, so the slot can't go back to the budget in between. A test covers an origin capped at two requests.
Suffix span. It installs only for the current request, and only where it ends at the size the open learned. A span installed before the size was known is dropped if it doesn't fit. The size probe now publishes under the reader's lock.
Poll interval. The progressive segment poll is back to main's 20 ms.
Checks.swift build passes. 5,863 swift-testing and 17 XCTest tests run, with one failure: an APAC encode test that also fails on the base.
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
enhancementNew feature or requestneeds-reviewNeeds maintainer review to resolve uncertain classification, scope, or changed evidence.size/XL500–999 added + deleted lines (all files); change volume, not priority.
1 participant
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.
Summary
Cuts cold-start latency for HTTP playback by running Dolby Vision capability probes concurrently, prefetching Matroska
CuesfromSeekHeadentries during open, kicking off the HLS background index pass before the composition-offset probe, tightening progressive-delivery segment waits, and deferringsubtitleForwardPrefetcheruntil the session is ready.What changed
VTCapabilityProbe: probes Dolby Vision hardware decode profiles concurrently instead of sequentially on cold launch.AVIOReader: parses MatroskaSeekHeadentries out of the opening bytes and prefetches trailingCuesin parallel so cue prewarm hits RAM instead of cancelling the initialbytes=0-stream on large MKV remuxes.HLSVideoEngine: startsbeginIndexPass()beforedecideCompositionOffsetRepair()so packet indexing overlaps with the repair check.SegmentCache: shortens the progressive-delivery wait step so ready segment fragments surface sooner.AetherEngine+Subtitles: holdssubtitleForwardPrefetcheruntilisSessionReadyso background subtitle harvesting does not compete for demuxer lock and bandwidth before first frame.aetherctl: adds--probesizeand--max-analyze-durationflags toplay(documented indocs/cli.md) to exercise existingLoadOptions.probesizeandLoadOptions.maxAnalyzeDurationbudgets.Tests: addsIssue281ColdStartRoundTripTestscoverage verifying MatroskaSeekHead-guided trailingCuesprefetch avoids extra origin round trips.CHANGELOG.md: records the Silo fork startup improvements under[Unreleased].Test plan
swift testtargeted suites passed (43/43 tests in 4 suites includingPublicAPIDocumentationTests,DocumentedConstantsTests,Issue281ColdStartRoundTripTests,StartAfterCuePrewarmTests,Issue151SubtitleForwardPrefetchTests,SourcePrewarmPlanTests, plus earlier 66/66 run includingFabricatedRangeOriginTests,Issue240SideReaderLinkPriorityTests,Issue295RangeBoundaryRefetchTests);Scripts/check-doc-links.pypassed; signed iOS and tvOS builds compiled and played back cleanly.Checklist
CHANGELOG.mdupdatedfeat(...),fix(...),chore(...))Council review
Rounds: 3, last reviewed at the round-2 fix head; round-3 fixes end at
2556b01e.Visual review: not run; nothing changes on screen. Fixed in review: verdict cache keeps supported verdicts only, trailing Cues prefetch only for the playback demuxer, suffix completion timed from its own start, trailing span validated, CHANGELOG corrected. Round 3: the tail prefetch takes the superseded slot before cancelling it, the suffix span installs only for the current request at the open's size (published under the reader's lock), and the poll is back to 20 ms.
Evidence: https://evidence.siloserver.org/pr/aetherengine/31/
AI Disclosure: Harness: Antigravity (T3 Code); Tool(s): T3 Code, Antigravity agent; Model(s): gemini-4-neon; Involvement: AI-assisted; Adversarial review: see Council review above; review fixes by Claude Code (claude-opus-5-5) in T3 Code.
Note
Overlap DV probe with MKV Cues prefetch and defer subtitle prefetch at startup
AVIOReadergains aprefetchesTrailingIndexflag (default false), enabled viaDemuxerOpenProfile.prefetchingTrailingIndex()for playback opens in HLSVideoEngine.swift and AetherEngine.swiftOriginRequestBudget.Ticket.takemethod in OriginRequestBudget.swift, and is capped at 4 MiB. Superseded completions are fenced with a generation counter--probesizeand--max-analyze-durationflags toaetherctl playfor measuring startup time, documented in cli.mdAVIOReaderteardown and size-probe paths in AVIOReader.swiftMacroscope summarized 094be23.