Skip to content

fix(vod): preserve seekability through bounded source recovery - #713

Merged
superuser404notfound merged 1 commit into
superuser404notfound:mainfrom
yucelokan:codex/bounded-vod-source-opening
Oct 8, 2026
Merged

superuser404notfound merged 1 commit into
superuser404notfound:mainfrom
yucelokan:codex/bounded-vod-source-opening

Conversation

@yucelokan

Copy link
Copy Markdown
Contributor

Summary

Recover unanswered HTTP VOD opens within caller-selected budgets without silently downgrading a seekable source. Report actual source/seek capability and native seek landings so a known duration cannot masquerade as working seeking.

What changed

  • Retry an unanswered data request once with open-ended Range; retain the successful connection and fail an exhausted open without repeating it in routing.
  • Bound size discovery as one operation; serialize it for single-request origins and cancel/join losing probe workers.
  • Expose isSourceSeekable / canSeek, reject unsupported forward-only seeks and ignore unreachable saved positions.
  • Honor native seek completion and actual landing; include requested/actual values in diagnostics.
  • These changes are grouped because the original failure combined delayed opening with false seekability. The real-media fixture checks recovery and seeking together.

Test plan

  • Device / OS: Apple M1 Pro Mac, macOS 27.0.1; Xcode 27.0 (27A266a), Swift 6.4.
  • Source media: synthetic MKV, H.264 (libx264, 320×180/25 fps, yuv420p with B-frames), AAC 48 kHz and embedded SubRip, SDR/no HDR-DV, served by a loopback HTTP origin with silent first-request and sequential variants. Reader tests also use controlled binary bodies and HTTP refusal/cancellation cases.
  • Result: swift test --jobs 4 --filter 'SourceOpen|VODSeek|OriginRequestBudget|AVIOReader|ProbeCancellation|ProbeHTTP|CancellableLoad|PublicAPIDocumentationTests|DocumentedConstantsTests' passed: 19 XCTest and 93 Swift Testing cases. FFMPEG_BIN=<ffmpeg> bash Scripts/test-vod-open-seek.sh passed both real AVPlayer cases: recovered readiness in 1.219 s with two requests, forward/backward seeks landed at 12 s / 4 s, paused seeking worked, and the sequential source rejected seeking without a false landing. The engine also builds for arm64 tvOS Simulator with Xcode 27. swift build --jobs 4, documentation links and git diff --check pass.
  • Production use: this behavior already ships in WUW's App Store release, with physical iPhone and Apple TV use. The isolated PR revision is based on upstream 7.28.3; the reproducible checks above describe this revision rather than claiming a new device run.

Checklist

  • CHANGELOG.md updated
  • Commit messages follow Conventional Commits (feat(...), fix(...), chore(...))
  • The fix lives in the engine, not in a host-side workaround
  • Public API changes are intentional and documented

superuser404notfound pushed a commit that referenced this pull request Oct 8, 2026
seek(to:) names the forward-only rejection and the 0.75 s landing rule,
canSeek and isSourceSeekable sit beside it, and sourceOpenPolicy is a
LoadOptions row with its defaults, instead of two prose sections under
"Public but not host API".

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WJcXkGQrMiBPixVEFTSBJS
@superuser404notfound
superuser404notfound merged commit 1c41e06 into superuser404notfound:main Oct 8, 2026
@superuser404notfound

Copy link
Copy Markdown
Owner

Thank you. Merged into main (1c41e06f). It ships in the next release together with #712 and #714.

Before the merge I checked it against a real origin: a 25 GB 4K mkv from a Jellyfin server on the LAN, as a static download URL. The same aetherctl runs went through 7.30.0 and this branch:

  • Open: phase=first-data result=data after 58 ms, seekability=seekable.
  • Seeks: a 7,700 s jump past the produced window, a paused seek and a 10-seek burst (seektest) all landed exactly. seek completion ... landed=true every time, never landed=false, and the seek ledger and wedge metrics match the baseline.
  • Resume: a start at 1800 s anchors at the same segment as before.
  • Forward-only: with --sequential-origin, the saved position is dropped (mounts at 0) and the seek is rejected with sourceNotSeekable.

One follow-up on top (1ff32757): the docs moved out of "Public but not host API" into the seek(to:) / canSeek / isSourceSeekable rows of the Transport table, and sourceOpenPolicy into the LoadOptions table with its defaults.

superuser404notfound pushed a commit that referenced this pull request Oct 8, 2026
…ved async poll

CI run 37722262358 failed three SourceOpenRecoveryTests while every other
suite on the runner ran 50 to 80 times slower than locally. Each test drove
the reader into a short window (a slot wait of at most 4 s, a body stall,
the alternate data request) and then acted on it from an async test task
polling every 20 ms. On a starved cooperative pool that poll came back too
late: the teardown test's slot wait had already given up, so its
waiting == 1 never recurred and it hung into the 2-minute limit; the data
retry and the held connection hit an engine timeout of their own and failed
on an error they were not about (noResponse, a restart from byte 0).

ProbeTestTrigger runs the step on its own thread, which is where
ProbeTestJob already runs the engine half, and a missed window now fails at
once with a message instead of hanging.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01WJcXkGQrMiBPixVEFTSBJS
@superuser404notfound

Copy link
Copy Markdown
Owner

Released in 7.31.0 (3ae61dbc). One follow-up: the three timing-sensitive SourceOpenRecoveryTests hung or failed on a starved CI runner, because their async polls missed the reader's short windows. They now fire those steps from a thread (73409793), and a missed window fails at once instead of hanging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants