Repository navigation
fix(software): publish retained VOD ranges and honor bounded seek outcomes - #759
Conversation
20ac6ce
into
superuser404notfound:main
…aimed (#759) tvOS keeps software VOD packets in purgeable memory, and the store only learned of a reclaimed history chunk when a restore walked into it. The ranges #759 publishes therefore kept claiming that history until a seek proved it gone. The sampler now evicts emptied chunks (a purgeable-state query per history chunk, under a try-lock so it never waits on the store) before it copies the floors. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WJcXkGQrMiBPixVEFTSBJS
|
Merged as 20ac6ce, thank you @orut34iop. This is careful work: the per-chunk discard floors, the source-read versus storage split and the stale-result guards all hold up, and the regression coverage made the review straightforward. The branch no longer merged cleanly, and the push to it was refused, so I merged it from my side. Besides the CHANGELOG and one comment in One follow-up, c7ac32a: the in-memory store keeps history in purgeable VM. The kernel can empty a history chunk at any time, and until now the store only noticed when a restore walked into it, so the published ranges kept claiming that history until a seek proved it gone. The sampler now evicts emptied chunks before it copies the floors. It runs a purgeable-state query per history chunk under a try-lock, so it never waits on the store. The new test fails without the change. Two decisions after review:
Not released yet; it goes into the next AetherEngine release. |
Problem and resulting behavior
Software VOD can retain enough compressed packets to replay an earlier position while publishing no
residentRanges. Inferring a cache band from[currentTime, bufferedPosition]makes the band move or disappear during scrubbing. Publishing the actual retained ranges exposed related correctness problems: rounded VC-1 durations fragmented continuous coverage, a remote read error hid valid committed packets, and unsuccessful cold positioning could still be finalized as a successful resume/seek.This PR makes software VOD residency and positioning agree with the packet evidence and the demux result. A cached seek preserves verified coverage; a cold seek discards the old store and either lands or reports failure. Slow but progressing remote positioning receives a bounded opportunity to finish.
Changes
Publish retained packet coverage
BlockingWork.detached. Copy metadata under the lock and calculate spans outside it; no UI-time disk scans.currentTimeandseek(to:).Preserve committed data after a source read error
Honor resume/seek outcomes
.softwarePipelineFailed; the engine closes the seek as.stalledwithout overwriting the error with a playable state.SeekEvent.idcontract, without downstream request-ID extensions.Allow bounded remote positioning to finish
Relationship to upstream
476f73c7on 2026-10-15 to resolve the changelog conflict that prevented pull-request CI from starting. Both changelog entries are preserved; dependency files match that upstream commit, with no PR-specific dependency changes or unrelated downstream customizations.Regression coverage
Synthetic tests cover cached seek begin/prepare/settle, missing audio and audio islands, rounded VC-1 timestamps, reordering and real gaps, FIFO eviction with byte-identical reads, invalid timestamp watermarks, source errors versus storage failure, draining/replaying a failed source and resetting on a miss, display-origin mapping, paused publication, background execution, coalescing and stale publication rejection.
Positioning tests cover successful/failed resume, stop and caller cancellation, failed seek with/without an attached error sink, event identity, and superseding seeks. Loopback-origin tests verify exact bytes, bounded cold-detour bypass, retained hits without a new request and restoration of ordinary detours. The documented host budget has a source-backed documentation check.
Tests use synthetic packet envelopes, an existing generated test fixture and a local patterned HTTP origin. No private media, server or account is required. New prerequisite waits use the shared
waitFor; blocking packet consumption runs on an owned thread with cancellation closing the source.Validation
2026-10-15 conflict resolution: GitHub reported the previous head as conflicting and had created no CI run for it; the earlier green run belonged to
4a5eae0e. After merging official main, the full test/example build and 142 focused checks passed locally (119 Swift Testing tests in 17 suites under the strict one-thread cooperative pool, plus 23 XCTest documentation/API checks). The test bundle used a verified Apple Development signature. Documentation links and diff checks passed. CI passed on10600a5c: run 38681845346 completed successfully in all four jobs: macOS tests, tvOS/visionOS builds, iOS/release-tool build, and documentation links. Both the regular and strict one-thread Swift Testing runs passed 4,465 tests in 615 suites; packet-cache/runtime regressions and transport-probe builds also passed.On the 2026-10-14 upstream PR revision (before the main merge):
LIBDISPATCH_COOPERATIVE_POOL_STRICT=1and includes the blocking-executor source guard.python3 Scripts/check-doc-links.py: passed.git diff --check: passed.Package.swiftandPackage.resolvedare unchanged.During porting, compilation identified a downstream-only clock helper; the failure path now uses the existing upstream display-origin conversion. The first test run also exposed an unintended #775 dependency in the VC-1 fixture. That fixture now supplies explicit audio durations while preserving the rounded video timing, seven-picture reorder and real discontinuity. All failures were resolved before the successful run above; no production audio-duration behavior was changed.
Reproduce the focused selection with:
No full-suite or full-platform CI pass is claimed for this new head.
Downstream integration was separately built, development-signed and installed on Apple TV 4K (3rd generation), tvOS 27.2 beta. Eight distinct backward seeks outside the application packet cache succeeded. Two actual positioning operations took approximately 12 and 10 seconds, exceeding the previous 8-second cap. One total seek took approximately 15.5 seconds including an earlier read wait. Exiting a pending seek released resources in approximately 65 ms, reopening resumed video, and verified coverage remained visible while paused.
These are discrete device-control and diagnostic observations, not continuous audio or physical touch-remote acceptance, and not an installation of this exact upstream branch. Final physical retesting remains pending. Server/cloud cache coldness was not controlled.
The PR includes no media titles, filenames, URLs, screenshots, playback positions, account details, device identifiers or raw session logs.
Review boundaries
The existing public residency type is unchanged. Native AVPlayer late-landing recovery, software live DVR, decoder/audio routing, packet-cache capacity, dependencies and host-app UI are unchanged. Failed software positioning is intentionally surfaced instead of pretending the target was reached. Source failure is not treated as proof of storage corruption or as normal EOF.
Documentation updates explain the residency/error contract and finite positioning budget. The complete CI result above belongs to
10600a5c, including the follow-up and main merge. It does not replace physical device acceptance.