Repository navigation
fix(preview): keep every covering cam's decoder hot to stop pill-start flip flicker - #39
Merged
Merged
Conversation
…t flip flicker Previous PR (#38) tightened the video pool so cams without a layer in the descriptor get paused. That kept the GPU decoder cold for any cam that wasn't the active one — and as soon as a cut switched to one of those cams, Chrome had to re-warm + re-seek the decoder. Chrome's copyExternalImageToTexture path occasionally lands the first frame after such a (re-)seek upside-down, which presented as every pill flickering between flipped and right-side-up for the first few frames. Switch the target source: instead of reading the descriptor's single active layer, iterate `snapshot.pills` and put EVERY cam whose pill covers the current `tTimeline` into the targets map. The pool keeps all decoders running on their pill-correct source-time, the cut switch becomes a no-op for the decoder, and the upload picks up an already-hot stream — so the first-frame-after-seek path never fires. Source-trim semantics are still pill-aware (each cam's covering pill contributes its own `sourceInS/Out` window), so duplicate-source pills with distinct trims still seek to the right frame for that specific occurrence — the bug 1 fix from #38 is preserved. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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.
Summary
PR #38 introduced a regression: the video pool now pauses any cam not in the descriptor's active layer, which means inactive cams' decoders go cold. Cuts that later switch to one of them force a fresh play() + seek, and Chrome occasionally ships the first frame after a fresh seek upside-down on the WebGPU `copyExternalImageToTexture` path. User saw every pill start flickering between flipped and right-side-up for the first few frames.
Fix: derive the pool's per-cam targets from `snapshot.pills` directly. Every cam whose pill covers the current `timelineT` gets a target, not just the cuts-resolved active cam. All decoders stay hot and a cut becomes a no-op for the decoder. Source-trim is still pill-aware so the duplicate-pill source-frame fix from #38 is preserved.
Test plan
🤖 Generated with Claude Code