Skip to content

feat(live): configure fast startup and publish early DVR history - #712

Merged
superuser404notfound merged 2 commits into
superuser404notfound:mainfrom
yucelokan:codex/configurable-live-startup
Oct 8, 2026
Merged

superuser404notfound merged 2 commits into
superuser404notfound:mainfrom
yucelokan:codex/configurable-live-startup

Conversation

@yucelokan

@yucelokan yucelokan commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Make fast live startup configurable and publish usable DVR history promptly on a stable session timeline. Default startup admission remains unchanged; callers choose any live-return safety offset.

Why two commits in one PR

The first commit (bd38f198) admits playable media earlier; the second (f06df432) makes the resulting early playback usable for rewind and keeps its timeline stable across source PTS rollbacks. Testing the first commit with long GOPs exposed a delayed native seekable-range mirror: the picture could already play while the engine still advertised no DVR history. These belong to the same user-visible live-startup flow, so this PR verifies them together, while separate commits keep startup policy and timeline correctness independently reviewable. Each commit builds on its own checkout state; the first does not depend on the second.

What changed

  • Add optional grace and single-segment duration thresholds to LoadOptions and propagate them through reopens.
  • Preserve standard joins, explicit holdback floors, cancellation, segment cuts and upstream first-serve latch behavior.
  • Add admission regressions and a reproducible paced MPEG-TS/AVPlayer fixture script.
  • Publish only already-played, contiguous resident history when the native range mirror is stale; never advertise prefetched future media as rewind history.
  • Keep live display/seek coordinates stable across source timestamp rollback and fence deferred recovery against newer seeks or loads.
  • Document liveTargetDurationSeconds, currentItemLiveEdgeTime and caller-selected seekToLiveEdge(offsetSeconds:).

Test plan

  • Device / OS: Apple M1 Pro Mac, macOS 27.0.1; Xcode 27.0 (27A266a), Swift 6.4.
  • Source media: synthetic MPEG-TS, 320×180 at 25 fps, libx264/yuv420p with B-frames and 5 s / 10 s GOPs, AAC 48 kHz, SDR (no HDR/DV); delivered through a paced custom reader into real macOS AVPlayer.
  • Result: 92 XCTest and 17 Swift Testing cases passed with swift test --jobs 4 --filter 'LiveStartupAdmissionTests|Issue684|Issue686|Issue195|Issue189|PublicAPIDocumentationTests|DocumentedConstantsTests'. FFMPEG_BIN=<ffmpeg> bash Scripts/test-long-gop-startup.sh passed both media cases: first picture in 3.295 s / 3.187 s, clock progression, rewind after the measured range becomes available, and subsequent playback. These results are for the first commit, before the early-DVR fix. swift build --jobs 4, documentation links and git diff --check pass.
  • Second commit / combined flow: 96 XCTest and 99 Swift Testing cases passed with swift test --jobs 4 --filter 'LiveTimestampRollbackTests|LiveStartupAdmissionTests|LiveSeek|LiveWindow|Issue446|Issue189|Issue684|Issue686|PublicAPIDocumentationTests|DocumentedConstantsTests'. Both long-GOP media cases passed again: first picture in 3.449 s / 3.177 s; seekability in 4.516 s / 3.177 s from load (within 2 s after join), clock progression, rewind, and return to live with a 5 s caller offset. swift build --jobs 4 passed at both commit states. Timing values describe this local run, not latency guarantees.
  • 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.

Integration with related contributions

This branch builds and tests against main without the other contribution branches. It overlaps #714 in live-window publication and #716 in live preview coordinates. When integrating #714, preserve its current capacity-lease window and software resident floor alongside this PR's played-resident edge fallback and notePlayhead update; fallback eligibility must follow the effective renewed/expired native DVR window, not only the original load option. When integrating #716, its preview request/result conversions must use this PR's stable live session axis. These are merge-time integration points, not a claim that the branches can be combined in arbitrary order without adaptation.

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

@yucelokan yucelokan changed the title feat(live): make bounded startup admission configurable feat(live): configure fast startup and publish early DVR history Oct 7, 2026
superuser404notfound pushed a commit that referenced this pull request Oct 8, 2026
…s tables

seekToLiveEdge(offsetSeconds:), currentItemLiveEdgeTime, liveTargetDurationSeconds
and the two DVR lease calls are rows of the Live and DVR table, the timestamp-reset
contract sits beside them, and the two startup options plus softwareDVRRetention
are LoadOptions rows, instead of three 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 17795d3 into superuser404notfound:main Oct 8, 2026
@superuser404notfound

Copy link
Copy Markdown
Owner

Thank you. Merged together with #714 and released in 7.31.0 (3ae61dbc).

Integration notes:

Checked against a public HLS channel on the ingest path with .fastZap, this branch against 7.30.0+#713. The rewind range exists from the first second (the baseline showed an empty range for the first ticks), a seek 20 s back lands, and seekToLiveEdge(offsetSeconds: 6) lands 6 s behind the edge. On a 12 s-segment channel, startup with and without liveStartupSingleSegmentMinimumSeconds matched the baseline.

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