Repository navigation
fix(studio): scrubbing across a cut shows the newest frame, not black - #8501
Merged
Merged
Conversation
Contributor
Edit accuracy: accurate 271 (base branch 271), smooth 63 of thoseThe gate passes. Quarantined, measured but not gated (0) |
… throw never stalls
jrusso1020
approved these changes
Nov 22, 2026
jrusso1020
left a comment
Collaborator
There was a problem hiding this comment.
Approve at 216f8715.
Need ✅ (a scrub across a cut showed black; blocks v0.9.81) · Size ✅ (+86/−20, 2 files) · Reuse ✅ · Simpler ✅ · Structure ✅
Risk: low. The host still runs one decode at a time, and the limits on sources and frame bytes are unchanged. Only which ask wins changes: the newest now replaces the pending one, where before the newest was refused.
What I checked:
- Fails without the fix: I put
pausedVideoProvider.tsback to main. "decodes the newest ask once an aborted decode settles, never two at once" fails, and so do the updated "replaces a decode a newer one overtakes" row and the 20-ask flood row. At the head 12/12 pass, 3 runs in a row. - The wait is guarded by a test: with
await previousdropped (two decodes at once), the same 3 rows fail, so the one-at-a-time rule is pinned. - The turn chain: asks A, B, C in a row: B aborts A and answers it "replaced", C does the same to B, and B skips its decode once A settles, so only C decodes. Each id gets exactly one reply: the replaced one's catch stays quiet because its signal is aborted, and
senddrops images for an aborted signal. A frame's ownabortstill cancels without a reply, as before.closeaborts everything, and the waiting turns then skip. - Frame side:
prepare(corepausedVideoFrames.ts) treats afailedreply like any decode error, the same path "busy" took before. Only which of two overlapping asks fails has changed. - Merge and types:
merge-treeagainst current main is clean, andtsc --noEmitin studio is clean.
— Rames (hf-review)
Merged
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.
What
Scrubbing the preview across a cut shows the new clip's frame instead of a black one. The paused-frame host in Studio now decodes the newest frame it's asked for. Before, it refused that ask while an older, cancelled decode was still finishing.
Why
Since #8466, the preview frame asks Studio for each paused video frame over a port, and Studio's host runs one decode at a time. While you drag the playhead, the frame cancels the decode for the old position and immediately asks for the new one. The host kept the cancelled decode's slot until that decode finished, so it answered the new ask "Preview decoder busy", and nothing asked again. With no decoded frame for where the drag stopped, the preview fell back to the video element, which has no frame yet at the first moment of a new clip: black.
Refusing was the wrong answer for a scrub: the ask it dropped was always the newest one, the frame the drag stopped on. A continuous-sample drag across the cut, on the current main (6 runs each, unsealed and sealed), got "Preview decoder busy" twice in every run and showed black in 3 of 12 runs. With this change: no "busy", and black in 0 of 12.
The Studio timeline viewport gate catches this. Its drag into scene B sampled pure black (0,0,0) at the cut in the unsealed preview, in every failing run since #8466 and in none of the 87 passing runs before it.
How
pausedFrameHostis latest-wins. A new ask cancels any decode still running for an older one, and that older ask gets afailedreply ("Preview decode replaced"), so the frame never waits on it.Before
The gate's drag into scene B on main: the clock reads B, the background is black.
After
The same drag with this change: scene B mid-drag shows its blue background.
Test plan
fails without the fix: "decodes the newest ask once an aborted decode settles, never two at once" in packages/studio/src/player/lib/pausedVideoProvider.test.ts
packages/studio/src/player: 2680 tests in 219 files; corepausedFramesandpausedVideoFramestests (19); Studiotscclean.