Skip to content

feat(preview): return cancellable resident frames with measured timestamps - #716

Merged
superuser404notfound merged 1 commit into
superuser404notfound:mainfrom
yucelokan:codex/timestamped-resident-previews
Oct 7, 2026
Merged

superuser404notfound merged 1 commit into
superuser404notfound:mainfrom
yucelokan:codex/timestamped-resident-previews

Conversation

@yucelokan

@yucelokan yucelokan commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Let hosts request timestamped previews from media already resident in the active session, without another source connection or playback seek. Reject cancelled work and results from replaced sources.

What changed

  • Add ScrubFrame and engine APIs with measured session time, refinement and resident bounds.
  • Propagate cancellation through native extraction, packet copying and software still decoding.
  • Fence source changes and retain segment identities while asynchronous native decoding runs.
  • Use upstream's existing live presentation-axis mapping so this branch builds independently; when integrating with feat(live): configure fast startup and publish early DVR history #712, use that PR's stable live session axis for the same conversions.

Test plan

  • Device / OS: Apple M1 Pro Mac, macOS 27.0.1; Xcode 27.0 (27A266a), Swift 6.4.
  • Source media: in-memory MP4 with a single 64×64 MPEG-4 Part 2 video frame (no audio, SDR), synthetic fragment epochs and packet-ring payloads. Dolby Vision hardware exclusion is a policy assertion, not a new DV media run.
  • Result: 34 XCTest and 31 Swift Testing cases passed with swift test --jobs 4 --filter 'FrameDecodeContextHardwareTests|FrameExtractor|SoftwareStill|SoftwarePacketReadAhead|PacketRingBufferTests|ScrubThumbnailSegmentMappingTests|PresentationAxis|PublicAPIDocumentationTests|DocumentedConstantsTests'. Tests cover actual PTS, a missing refined target beyond EOF, cancellation, replaced/missing segment files, packet-copy cancellation and timeline mapping. 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.

Integration with related contributions

This branch builds and tests against main independently. With #712, replace the upstream seam-based live preview request/result mapping with that PR's stable live session axis, capturing the mapping consistently around asynchronous extraction. With #717, retain both resident-time and decoded-time callbacks in FrameDecodeContext, including recursive hardware-to-software fallback, and cancel an in-flight bounded extraction when a new resident extraction supersedes it. The two preview APIs share the extractor queue and cancellation ownership; neither implementation should replace the other during conflict resolution.

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

Copy link
Copy Markdown
Owner

Thank you. Merged together with #717 and released in 7.30.0 (beed2cc5).

Integration notes:

  • It conflicted with 7.29.0's held-picture still (afterFirstFrame on decodeFrame, startSeconds on ScrubThumbnailSource). Both are kept: decodeFrame takes the offset and the resident parameters side by side, and ScrubThumbnailSource carries one startSeconds for both users.
  • The docs moved out of "Public but not host API" into the Stills and thumbnails table, with ScrubFrame under Value types.

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