hyperframes icon indicating copy to clipboard operation
hyperframes copied to clipboard

Periodic near-black frame in chunk-lambda renders (first video inject per session)

Open zihanyang-dev opened this issue 4 months ago • 0 comments

Chunk-lambda renders drop a periodic near-black frame — one bad frame every chunk_frames / worker_count frames. On a single-video 4-worker chunk that's every 60 frames, and signalstats catches it cleanly: YAVG ~22 against YMAX ~240. Local single-process renders never show it, since they don't run under BeginFrame.

It comes from the isNewImage branch in injectVideoFramesBatch. The first time a session paints a given videoId there's no __render_frame__ sibling yet, so it creates the <img> on the spot — createElement + insertBefore. captureFrameCore fires beginFrameCapture right after, and the paint flush in frameCapture.ts is skipped whenever we're in beginframe mode. So under HeadlessExperimental.BeginFrame the compositor hasn't pulled the freshly-inserted layer into its tree by the time we capture — it lands a tick later, and that frame comes out as body background plus whatever was already composited (the YAVG ~22 signature). Each lambda worker is its own session, so it recurs at every worker boundary.

zihanyang-dev avatar Jul 07 '26 01:07 zihanyang-dev