Repository navigation
Make the seek signal's falling edge trustworthy, and publish a seek-lifecycle stream (#38) - #252
Merged
Conversation
…g edge trustworthy (#38) isSeeking/seekTarget are a level, and a level's falling edge cannot say whether a seek landed, gave up or was superseded, nor carry the target it belonged to. The synchronized-playback host that asked for the signal rebuilt that host-side out of a 1.5s landing grace, a retained last target and a 180s unreached-target map. seekEvents publishes .began, .landed(renderedTime:), .stalled, .superseded and .rejected, each with its target and an id pairing a seek to its outcome. The one asymmetry is the point: a seek that spends its recovery budget reports .stalled and leaves isSeeking, but stays alive inside AVPlayer, so its .landed can still arrive minutes later on a source that finally serves the target. Mechanics around it: - A native scrub's window now ends when the PICTURE reaches the restarted region (watched on $renderedTime, bounded at 8s), not when the coalesced producer restart drains. Draining means the producer is producing at the new index; the picture follows a fetch and a decode later, 1.4s on a WAN source. A restart that a programmatic seek caused is left to that seek's events, since the restart segment can sit below where the picture lands (seektest: restart 84.0, landing 90.0). - Seeks stashed before the session can take them (#127/#178) carry the seek signal. They published their target on currentTime with isSeeking false, which is the worst combination for a consumer broadcasting position. The stash hands over to its replay without a gap in the level. - seekTarget follows the most authoritative in-flight source instead of the last non-nil target ever written, which kept a settled seek's destination published while a scrub was in flight toward a different one. - stopInternal releases the #240 side-reader link gate; a stop landing mid-seek left it owned by the video path for the whole next session. seektest gains a #38 event ledger (unpaired .began = a stranded in-flight window). Verified on the real loopback path: 11 begans, 11 terminators, none unpaired. Reported by rrgomes from production use on a 2-Apple-TV + WAN peer setup. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01At1agC2qU2Y2MX2BKLdT4N
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Follow-up to #38, from rrgomes' production report on the shipped signal: it held up as the authority for "do not broadcast yet", but three edges needed host-side guards, and one case the signal never saw at all.
isSeeking/seekTargetare a level, and a level's falling edge cannot say whether a seek landed, gave up or was superseded, nor keep the target it belonged to (both properties clear in the same recompute, and any consumer that hops a queue sees them coalesced). The reporting host rebuilt that out of a 1.5 s landing grace, a retained last target and a 180 s unreached-target map.Added
AetherEngine.seekEvents: AnyPublisher<SeekEvent, Never>. Every accepted seek emits.beganand exactly one of.landed(renderedTime:),.stalled,.supersededunder the same id; a seek that never reaches a host emits a standalone.rejected. The one asymmetry is the point of the stream: a seek that spends its recovery budget reports.stalledand leavesisSeeking, but stays alive inside AVPlayer as recovery intent, so its.landedcan still arrive minutes later on a source that finally serves the target. That is the transition no level signal can carry, and the reporter's 180 s map exists exactly to approximate it.Every event is also an
EngineLogline, so a host that has not wired the stream still gets the statement on device.Fixed
$renderedTimeand bounded at 8 s so a source that never serves it degrades to.stalledinstead of latching the signal. A restart that a programmatic seek itself caused is left to that seek's events:seektestmeasured a restart at 84.0 for a landing at 90.0, so the restart segment is a lower bound on the landing, not a point.currentTimeso scrub UI follows, withisSeekingfalse: a position nothing has reached, and no flag to suppress broadcasting it. The stash window now carries the signal and hands over to its replay without a gap in the level.seekTargetpublished a settled seek's destination while a scrub was in flight toward a different one (it folded over the last non-nil target ever written). Each source owns its own target now.Verification
swift build -Xswiftc -strict-concurrency=completeand a tvOS Simulator build both clean.aetherctl seektestgains a#38 SEEK EVENT LEDGER(an unpaired.beganis a stranded in-flight window). On the real loopback path: 11 begans, 11 terminators, none unpaired, and the existing Seek on the loopback-HLS native path resolves clock + state before the seek lands → reported time bounces back through the pre-seek position #37/Expose an accurate in-flight seek signal (isSeeking / seekTarget) that spans the real loopback-HLS landing and covers native scrubs #38 probe still passes.$renderedTimehook.Refs #38.
🤖 Generated with Claude Code
https://claude.ai/code/session_01At1agC2qU2Y2MX2BKLdT4N