Land a driven video's seek without a frame so it is never empty (#404)
game-maker / gate (push) Successful in 4m9s
game-maker / suite (push) Successful in 17m18s

Since b9fcf48 a seek of a driven video only counted as done once
Chrome handed over the next frame. For some seeks Chrome hands over
none. The player then waited for good, the view left the sprite out
after 0.3 s, and the picture stayed empty until the next jump.

- A seek now lands after `seeked` with the next frame, or after
  150 ms at the latest. The worst case is a picture 150 ms late.
- The landing is set up in the `seeked` handler instead of `seek`.
  A frame from before the last seek of a chase no longer counts.
- `__gm.videos()` reports `landing`, so an empty picture can be told
  apart from a player that is still loading.

Findings:
- The empty picture could not be reproduced in Chrome headless.
  The test video is 320x180 and decoded in software. The user's
  videos are 1080p60 H.264, likely decoded in hardware.
- The user confirmed the fix in the editor.

Tests:
- Unit video-library + video-follow: 20 green (1 new). The new test
  plays a video that hands over no frame after a seek. With the old
  code it stays not ready, so it fails.
- e2e 66 on melektaus-atx: ALL PASSED, 29 checks. The new 66r cuts
  LATE ten times quickly and was also green with the old code.
- Gate on melektaus-atx: CHECK EXIT 0, 297 files, 4563 tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Opus 5.5 committed 2026-10-11 19:04:40 +02:00
1 parent 8118b8042b
commit 36ffd9a61a
4 files changed
+110 -18

No files matched your search

+23
View File
@@ -533,6 +533,29 @@ export async function video(t) {
JSON.stringify(cutFrames),
);
// 66r. Cut in and out fast, at times a hair apart: a seek that brought no new frame of the video
// left its player waiting for one for good, and the sprite stayed empty until the next jump.
const cuts = [0.7, 1.31, 0.05, 1.62, 0.4, 1.9, 1.05, 0.25, 1.48, 0.9];
for (const [i, time] of cuts.entries()) {
await cutLate(false, 0.2);
await sleep([0, 30, 90][i % 3]);
await cutLate(true, time);
await sleep([60, 0, 140][i % 3]);
await cutLate(true, time + 0.01);
await sleep([20, 120, 0][i % 3]);
}
await cutLate(true, 1.2);
await sleep(40);
await cutLate(true, 1.21);
await sleep(1500);
const settled = (await json('__gm.videos()')).filter((v) => v.key.includes(LATE));
const settledColor = await colorAt(lateRect);
check(
'cut in and out fast, a driven sprite still ends on its picture and no player waits on',
settledColor === COLORS.blue && settled.length > 0 && settled.every((v) => !v.landing),
JSON.stringify({ settledColor, settled }),
);
await mutate(`
const p = __gm.state.project;
const gone = ['${OBJECT}', '${EARLY}', '${LATE}'];