Skip to content

fix(player): avoid black flash at playback startup - #761

Merged
stackia merged 1 commit into
mainfrom
codex/fix-player-startup-flash
Sep 9, 2026
Merged

fix(player): avoid black flash at playback startup#761
stackia merged 1 commit into
mainfrom
codex/fix-player-startup-flash

Conversation

@stackia

@stackia stackia commented Sep 9, 2026

Copy link
Copy Markdown
Owner

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 readyState is still HAVE_METADATA, so primeCanvas() 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 requestVideoFrameCallback can fire before readyState reaches HAVE_CURRENT_DATA, so primeCanvas() skips and the canvas stays empty until the next frame.

scheduleFrame now calls processFrame when 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.ts with 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.

@cursor

cursor Bot commented Sep 9, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot 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)

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Documentation preview

The documentation preview has been deployed for this pull request.

@stackia
stackia merged commit 25db2b6 into main Sep 9, 2026
12 checks passed
@stackia
stackia deleted the codex/fix-player-startup-flash branch September 9, 2026 16:21
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.

3.17.0回看出画面后会黑屏一下 在继续播放

1 participant