fix(player): avoid black flash at playback startup - #761
Merged
Conversation
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_40b4b4e6-1aac-432c-bbd6-8479647640cc) |
Contributor
Documentation previewThe documentation preview has been deployed for this pull request. |
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.
Fix the brief black flash after the first picture when picture enhancement or deinterlacing is enabled. This fixes a startup regression introduced in #755.
The first video-frame callback can arrive while
readyStateis stillHAVE_METADATA, soprimeCanvas()skips drawing. The callback now renders that decoded frame when startup left the texture ring empty, instead of exposing an empty canvas until the next frame. Successfully primed frames still avoid a duplicate upload and filter pass.Validation: five focused regression tests cover enhancement, deinterlacing, both enabled, already-primed startup, and raw-video fallback. The three affected cases fail before the fix. All 48 frontend tests, TypeScript, changed-file Biome checks, and the production frontend build pass. Six Chrome/WebGL playback cases using generated fixtures, including progressive and 1080i H.264/MP2 MSE playback, show no black frames after the first picture and no GL errors. The low-frame-rate fixture reproduces the black flash before the fix. E2E lint and both collection entry points also pass (626 tests collected; daemon tests were not run for this frontend-only change).
Fixes #760.
Note
Low Risk
Narrow change to first-frame scheduling in the video render loop, with regression tests; no auth, data, or API surface changes.
Overview
Fixes a startup black flash when picture enhancement or deinterlacing is on: the first
requestVideoFrameCallbackcan fire beforereadyStatereachesHAVE_CURRENT_DATA, soprimeCanvas()skips and the canvas stays empty until the next frame.scheduleFramenow callsprocessFramewhen the texture ring is still empty (textures.length === 0), not only when the loop was already running (wasRunning). Frames that were already primed still skip a second upload/filter pass.Adds
renderer.test.tswith Vitest coverage: first-frame present for enhancement/deinterlace combos, no double upload when startup is already primed, and no GL path when both processing features are off (mocked presenters/GPU).Reviewed by Cursor Bugbot for commit 99c97d4. Configure here.