Skip to content

feat(engine): frame-capture core — fast-capture routing, worker-encode, dedup extension#1919

Open
vanceingalls wants to merge 1 commit into
de2-03-threedfrom
de2-04-engine-core
Open

feat(engine): frame-capture core — fast-capture routing, worker-encode, dedup extension#1919
vanceingalls wants to merge 1 commit into
de2-03-threedfrom
de2-04-engine-core

Conversation

@vanceingalls

@vanceingalls vanceingalls commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

Frame-capture core — routing, worker-encode, static-dedup unification (stack 4/6)

The heart of the feature. Wires drawElement capture (2/6) + the risk gate (3/6) into the capture loop, adds worker-offloaded encode, and unifies our static-frame dedup with the implementation main shipped independently.

packages/engine/src/services/frameCapture.ts (+714 / −33)

  • Capture-mode routing — screenshot / BeginFrame / drawElement selection + the gate chain (video, stacked-fade, 3D, detectCssEffectRisk) that routes incompatible comps to the screenshot baseline.
  • Worker-encode pipeline — depth-2 pipeline handing drawElement frames to the OffscreenCanvas encode worker (produceDrawElementFrame); frees the main thread so capture (paint-wait + readback), not encode, is the throughput bound.
  • Per-frame screenshot fallback — a drawElement frame that fails (No cached paint record, clip-cut boundary) falls back to a screenshot for that frame instead of aborting the render.

⚠️ Static-dedup unification (reviewer attention)

main and this branch each independently implemented static-frame dedup with the same symbol names. This PR keeps main's implementation as canonical (default-on config.staticFrameDedup, clip-start safety, density-verify backstop, observability) and extends it to the drawElement + worker-encode path — worker-path frame reuse (lastEncodeResult) + blank-frame detection (deFrameSizes), armed on the drawElement-proceed site (pre-canvas-injection, so main's screenshot-based density-verify remains a valid backstop for the DE path). Our opt-in HF_STATIC_DEDUP env is dropped — superseded by main's single default-on config switch governing both capture modes. Net behavior change: static-dedup is now default-on for both screenshot and drawElement paths.

Also: browserManager.ts, screenshotService.ts, index.ts (exports/glue).


Stack: #1916#1917#1918#1919 (here)#1920#1921. Rebased onto current main; supersedes #1295 + #1444. Intermediate PRs don't compile independently — feature green at the tip (#1921), tsc-clean + 231 tests pass.

🤖 Generated with Claude Code

vanceingalls commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator Author

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.

1 participant