fix(video): a movie's picture waits for its clock, so its sound is no longer late at 240 fps #2264

Merged
HumanBean merged 5 commits from d4nkn3ss/Longshot:fix/movie-pace-av-sync into main 2026-11-23 16:11:37 +00:00
Contributor

Summary

Fixes #1964. In the opening and on the title screen, the movies' sound came late against their picture: up to a second
or two for the reporter, and 0.73 s by the end of the opening on an RTX 3080 here. Capping the game at 60 in the NVIDIA
app made it go away.

The sound wasn't late. The picture ran early. While a movie plays, Longshot paces at 240 fps (#488, so a 60 fps loop
doesn't skip pictures), and the game takes the next picture when its own count of the movie's 60ths says so
(hos_movie_frames, host/nn_vi.c). At 240 that count follows the frames' time, not the clock, and drifts: here it ran
ahead at ~226 fps (0.2 s after 6 s, 0.73 s at the end of the opening). The movie's sound keeps the clock.
dec_acquire already skipped pictures that fell behind the clock, but handed out early ones.

Now a picture more than 25 ms ahead of the movie's clock waits in the queue, and the buffer handed out shows the last
picture again (copied in from the buffer that has it). Not a movie's first or last picture, and only for pools the game
reads through ReadDecoderOutputImage*, as OoT's are. HOS_VIDEO_NO_HOLD=1 turns it off. The movie's video: a movie of ... line now counts the holds. Held deliveries also count in the delivery pacing statistics.

To see it on main: play the opening (a fresh profile, or Skip opening off) at the default 60 cap on a PC that
holds 240 fps there: the narration and music fall behind the picture as the opening goes on. With HOS_VIDEO_LOG=1,
the video: acquire N: picture at X s, wall clock Y s (behind by Z s) lines show Z going negative.

Read first: the new block in dec_acquire (host/nn_video.c), after the catch-up.

Testing

Tested before the held-delivery accounting change: Windows 11 (26300), RTX 3080, NVIDIA 621.14, a build of this branch. The opening played from a fresh
profile at the default 60 cap (the movie pacing at 240), sound on and recorded with HOS_AUDIO_DUMP, HOS_VIDEO_LOG=1,
and a script stamping each log line and the WAV's growth with the clock. Each run's sound was placed on its picture
timeline and cross-correlated with a run with the pacing off (HOS_MOVIE_PACE=0, 60 fps, where picture and sound agree
within 10 ms). With this branch the picture stays within 20 ms of its clock through the opening and on the title's
looping movie, and the sound lines up with the pacing-off run within 10 ms (main: 690 ms). Screenshots during the
opening and on the title: the pictures are whole, no stale or torn frames.

Checks before the held-delivery accounting change: tests/test_video_hold_early.py fails on main (the early picture is handed out) and passed on the branch, with clang++
and g++, both ways of the switch. The added held-delivery accounting checks are pending. tests/test_video_catchup.py and the other checks that read host/nn_video.c pass.
The whole suite (tests/run_all.py, without test_job_queue): 867 passed, 31 failed; the same 31 fail on main
@ a2dc5385 (Windows-only tool and test-environment failures, e.g. test_switch_table's RX_VK_GRASS_DISTANCE sort,
test_guest_copies, test_crash_dialog).

Still to test:

  • Linux (any GPU): build, then play the opening at the default cap with HOS_VIDEO_LOG=1, expecting the behind by
    values to stay within about 0.03 s. This PC has no Linux toolchain (@Beanstalk or by hand).
  • Steam Deck: the opening at the default cap, expecting the same, and the skipped count in the movie's line near
    #488's (by hand).
  • The reporter's PC (RTX, 240 fps steady): the opening and title, expecting no late sound (by hand: #1964's reporter).

Measurements

Verdict: the opening's picture no longer runs ahead of its sound at 240 fps: 0.73 s ahead at the end on main,
0.01 s here.

Setup: Windows 11, RTX 3080, NVIDIA 621.14; the opening (5947 pictures) from a fresh profile, default options, the 60
cap with the movie pacing at 240; measured from the HOS_VIDEO_LOG lines and the WAV dump as Testing says. The PC was
locked (no one at it), which stalls presents now and then; these are times against the clock, not frame rates.

Before: main @ a2dc5385 After: this PR @ 9d487066
Frame rate in the movie (median of the 5 s counts) 215, 218 fps 226 fps
Picture against its clock at the opening's end 0.73, 0.86 s ahead 0.01 s ahead
Sound against picture, relative to pacing off (HOS_MOVIE_PACE=0, 60 fps) +690, +830 ms (late) +10 ms
Pictures skipped (of 5947) 3, 2 21
Last picture shown again (holds) n/a 89

The second run of this PR ran at 120 fps (the locked PC halved the present rate for that run, as it did for one run
of main with a probe): there the count runs slow, not fast, so the catch-up skips and nothing is early. Picture at
the end 0.02 s behind, sound -10 ms, 218 pictures skipped and 3 holds, against 230 skipped on main at 120 fps; it is
listed here, not in the table, because the table's two sides are at ~220 fps. Pacing off for reference: 60 fps, 0.01 s,
25 skipped.

Main merged into the branch at 5534c6b8 (b9bd74a2, no conflicts); its checks and test_switch_table (failing as on main) ran again after the merge. Held-delivery accounting changed after the measurements and checks; verification on the current code is pending.

Risks

  • The hold only ever shows the last picture a little longer; a picture is never dropped by it. A copy of one 1080p
    NV12 picture (3 MB, plus RGBA when it was made) when a hold uses a different buffer: 89 holds in the 99 s opening here.
  • A count that runs slow (seen at 120 fps here) is already handled by the catch-up's skips, unchanged.
  • The game's own count still drifts at 240, so a cutscene's cues placed by it (subtitles, rumble) can still lead the
    picture by that much. Not changed here.
  • Off: HOS_VIDEO_NO_HOLD=1, or a revert. Nothing changes in saves or options.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named). Pending on the current code.
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here.
  • A switch added or changed: it ships at the default the measurements chose, with its row in gpu/vk/switches.def.
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. Windows built and run; Linux not built:
    no Linux toolchain on this PC (Still to test).
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

## Summary Fixes #1964. In the opening and on the title screen, the movies' sound came late against their picture: up to a second or two for the reporter, and 0.73 s by the end of the opening on an RTX 3080 here. Capping the game at 60 in the NVIDIA app made it go away. The sound wasn't late. The picture ran early. While a movie plays, Longshot paces at 240 fps (#488, so a 60 fps loop doesn't skip pictures), and the game takes the next picture when its own count of the movie's 60ths says so (`hos_movie_frames`, `host/nn_vi.c`). At 240 that count follows the frames' time, not the clock, and drifts: here it ran ahead at ~226 fps (0.2 s after 6 s, 0.73 s at the end of the opening). The movie's sound keeps the clock. `dec_acquire` already skipped pictures that fell behind the clock, but handed out early ones. Now a picture more than 25 ms ahead of the movie's clock waits in the queue, and the buffer handed out shows the last picture again (copied in from the buffer that has it). Not a movie's first or last picture, and only for pools the game reads through `ReadDecoderOutputImage*`, as OoT's are. `HOS_VIDEO_NO_HOLD=1` turns it off. The movie's `video: a movie of ...` line now counts the holds. Held deliveries also count in the delivery pacing statistics. **To see it on main:** play the opening (a fresh profile, or *Skip opening* off) at the default 60 cap on a PC that holds 240 fps there: the narration and music fall behind the picture as the opening goes on. With `HOS_VIDEO_LOG=1`, the `video: acquire N: picture at X s, wall clock Y s (behind by Z s)` lines show Z going negative. Read first: the new block in `dec_acquire` (`host/nn_video.c`), after the catch-up. ## Testing **Tested before the held-delivery accounting change:** Windows 11 (26300), RTX 3080, NVIDIA 621.14, a build of this branch. The opening played from a fresh profile at the default 60 cap (the movie pacing at 240), sound on and recorded with `HOS_AUDIO_DUMP`, `HOS_VIDEO_LOG=1`, and a script stamping each log line and the WAV's growth with the clock. Each run's sound was placed on its picture timeline and cross-correlated with a run with the pacing off (`HOS_MOVIE_PACE=0`, 60 fps, where picture and sound agree within 10 ms). With this branch the picture stays within 20 ms of its clock through the opening and on the title's looping movie, and the sound lines up with the pacing-off run within 10 ms (main: 690 ms). Screenshots during the opening and on the title: the pictures are whole, no stale or torn frames. Checks before the held-delivery accounting change: `tests/test_video_hold_early.py` fails on main (the early picture is handed out) and passed on the branch, with clang++ and g++, both ways of the switch. The added held-delivery accounting checks are pending. `tests/test_video_catchup.py` and the other checks that read `host/nn_video.c` pass. The whole suite (`tests/run_all.py`, without `test_job_queue`): 867 passed, 31 failed; the same 31 fail on main @ a2dc5385 (Windows-only tool and test-environment failures, e.g. `test_switch_table`'s `RX_VK_GRASS_DISTANCE` sort, `test_guest_copies`, `test_crash_dialog`). **Still to test:** - Linux (any GPU): build, then play the opening at the default cap with `HOS_VIDEO_LOG=1`, expecting the `behind by` values to stay within about 0.03 s. This PC has no Linux toolchain (@Beanstalk or by hand). - Steam Deck: the opening at the default cap, expecting the same, and the `skipped` count in the movie's line near #488's (by hand). - The reporter's PC (RTX, 240 fps steady): the opening and title, expecting no late sound (by hand: #1964's reporter). ## Measurements **Verdict:** the opening's picture no longer runs ahead of its sound at 240 fps: 0.73 s ahead at the end on main, 0.01 s here. Setup: Windows 11, RTX 3080, NVIDIA 621.14; the opening (5947 pictures) from a fresh profile, default options, the 60 cap with the movie pacing at 240; measured from the `HOS_VIDEO_LOG` lines and the WAV dump as Testing says. The PC was locked (no one at it), which stalls presents now and then; these are times against the clock, not frame rates. | | Before: main @ a2dc5385 | After: this PR @ 9d487066 | |---|---|---| | Frame rate in the movie (median of the 5 s counts) | 215, 218 fps | 226 fps | | Picture against its clock at the opening's end | 0.73, 0.86 s ahead | 0.01 s ahead | | Sound against picture, relative to pacing off (`HOS_MOVIE_PACE=0`, 60 fps) | +690, +830 ms (late) | +10 ms | | Pictures skipped (of 5947) | 3, 2 | 21 | | Last picture shown again (holds) | n/a | 89 | The second run of this PR ran at 120 fps (the locked PC halved the present rate for that run, as it did for one run of main with a probe): there the count runs slow, not fast, so the catch-up skips and nothing is early. Picture at the end 0.02 s behind, sound -10 ms, 218 pictures skipped and 3 holds, against 230 skipped on main at 120 fps; it is listed here, not in the table, because the table's two sides are at ~220 fps. Pacing off for reference: 60 fps, 0.01 s, 25 skipped. Main merged into the branch at 5534c6b8 (b9bd74a2, no conflicts); its checks and `test_switch_table` (failing as on main) ran again after the merge. Held-delivery accounting changed after the measurements and checks; verification on the current code is pending. ## Risks - The hold only ever shows the last picture a little longer; a picture is never dropped by it. A copy of one 1080p NV12 picture (3 MB, plus RGBA when it was made) when a hold uses a different buffer: 89 holds in the 99 s opening here. - A count that runs slow (seen at 120 fps here) is already handled by the catch-up's skips, unchanged. - The game's own count still drifts at 240, so a cutscene's cues placed by it (subtitles, rumble) can still lead the picture by that much. Not changed here. - Off: `HOS_VIDEO_NO_HOLD=1`, or a revert. Nothing changes in saves or options. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [ ] `mise run test` passes (any failure that also fails on `main` is named). *Pending on the current code.* - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here. - [x] A switch added or changed: it ships at the default the measurements chose, with its row in `gpu/vk/switches.def`. - [ ] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. *Windows built and run; Linux not built: no Linux toolchain on this PC (Still to test).* - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
While a movie plays Longshot paces at 240 fps and the game takes the next picture by its own count of the movie's 60ths,
which follows the frames' time, not the clock: the picture ran up to 0.73 s ahead of the opening's sound on an RTX 3080.
dec_acquire skips late pictures but hands out early ones. The check: a picture 100 ms early is held back and the buffer
shows the last one again; one under 25 ms, the movie's first and last, and a pool read from memory are handed out;
HOS_VIDEO_NO_HOLD=1 hands every one out.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
fix(video): a movie's picture waits for its clock: the last one shown again while the next is early (issue 1964)
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 9s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
9d48706664
While a movie plays Longshot paces at 240 fps (#488) and the game takes the next picture by its count of the movie's
60ths, which follows the frames' time, not the clock. On an RTX 3080 at ~226 fps the opening's picture ran ahead of its
clock, 0.2 s after 6 s and 0.73 s at the end, while its sound kept the clock: the reporter's sound "late in the opening
and title movies", gone when the NVIDIA app capped the game at 60. dec_acquire skipped late pictures but handed out
early ones; one more than 25 ms early now waits in the queue, and the buffer handed out gets the last picture copied in
(both pools read through ReadDecoderOutputImage*, as OoT's are). Not a movie's first or last picture. The movie's line
counts the holds. HOS_VIDEO_NO_HOLD=1: as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Author
Contributor

Tested in game: Windows 11, RTX 3080, NVIDIA 621.14: the opening from a fresh profile at the default cap (movie pacing 240), sound dumped and log stamped; picture within 20 ms of its clock, sound within 10 ms of the pacing-off run (main: 690-830 ms late); title movie and screenshots fine

Tested in game: Windows 11, RTX 3080, NVIDIA 621.14: the opening from a fresh profile at the default cap (movie pacing 240), sound dumped and log stamped; picture within 20 ms of its clock, sound within 10 ms of the pacing-off run (main: 690-830 ms late); title movie and screenshots fine
Member

Possibly related, for context:

  • issue #73 The opening movies stutter: a quarter to a third of their pictures are skipped (RTX 3090, Linux) — Related opening-movie timing and skipped-picture issue
Possibly related, for context: - issue #73 The opening movies stutter: a quarter to a third of their pictures are skipped (RTX 3090, Linux) — Related opening-movie timing and skipped-picture issue
Merge remote-tracking branch 'origin/main' into fix/movie-pace-av-sync
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 9s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
5534c6b8a7
Owner
@review
BeanBot left a comment

Recommendation: Approve. The reported Windows run shows that the picture and sound move back into sync, but holds distort the existing movie pacing statistics. Linux, Steam Deck and other affected Tier 1 systems still need runs, including measurements of the copies' effect on pacing. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge.

Early movie pictures wait while the previous picture is shown again. The Windows RTX 3080 run reports much better synchronization, at the cost of copying picture buffers on holds and adding a switch and decoder state.

Should fix (1): not blocking, but worth doing before merging.

  • L1 host/nn_video.c:864: A held acquire returns before updating the existing picture-pacing counters and timestamp. (more on the line) Do: Record the acquire time, gap and shown count for held buffers as well, sharing the accounting with the ordinary output path.

Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)

  • L2 host/nn_video.c:856: The default-on hold path has not been exercised on Linux or Steam Deck, where decoder and pacing behavior can differ. (more on the line) Do: Build on Linux and run the opening and title loop on Linux and Steam Deck, checking synchronization, holds, skips and completion.
  • L3 host/nn_video.c:859: The full-frame copies on the movie thread have not been measured for their effect on pacing, including on slower CPUs and AMD Tier 1 systems. (more on the line) Do: Compare repeated base and PR opening runs on representative AMD and slower CPU hardware, including frame times, 1% lows and movie pacing. (@fix does its part first: Avoid copying the previous image on each hold by retaining or reusing a safe reference to it.)

@fix can do L1 and L3.

Questions (1) (not confirmed from the code; they don't hold the recommendation)

  • host/nn_video.c:849: Can the supported game have two movie decoders performing their first acquire concurrently?

Checks: Still running: 10 checks.

More: does it help, other systems, switches, what was read

Does it help: Yes, on the reported Windows RTX 3080 run: the picture was 0.01 s ahead at the opening’s end versus 0.73 and 0.86 s on main, and sound alignment improved from 690–830 ms late to 10 ms. The comparable table has one PR run; other platforms and the copy cost remain unmeasured.

Other systems: The hold runs in the shared decoder path for API-read pools, independently of GPU vendor. Windows RTX was tested; Linux, Steam Deck and AMD Tier 1 hardware were not. Direct-memory pools retain the previous behavior. The change does not alter saves, audio or input.

Switches: HOS_VIDEO_NO_HOLD is added as a developer kill switch, default off, so holding is enabled. Its table and reference rows are present. The reported Windows measurement supports the default there; its effect on the other affected systems remains to be checked.

Reviewed: 5534c6b8a7 against b9bd74a25e: Read AGENTS.md, CONTRIBUTING.md, docs/dev/standards.md, the pull request template, commit messages, the complete diff, host/nn_video.c, tests/test_video_hold_early.py and the related catch-up fixture. Skimmed the switch reference, switch table, test runner and performance-report consumers. docs/review-checklist.md and ../Tooling/AGENTS.md were absent.; nothing run (a code review).

Checked and fine:

  • The fixture checks the hold, its release when due, the switch, first and last pictures, and direct-memory pools.
  • The added switch is documented and has a switch-table row.
  • The change contains no committed game-derived output or generated shader files; the implementation and test commits record AI assistance.
  • No renderer API structure or shader was changed.

Testing: Read-only review; no builds, tests or project scripts were run. The author reports an in-game Windows RTX 3080 run and game-free checks; CI is still running.

Overlaps and merge order: Not checked; the network is closed.


Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The reported Windows run shows that the picture and sound move back into sync, but holds distort the existing movie pacing statistics. Linux, Steam Deck and other affected Tier 1 systems still need runs, including measurements of the copies' effect on pacing. Nothing blocking is left: what remains is for the author before merging (below). Recommend approval; not approved on the forge. Early movie pictures wait while the previous picture is shown again. The Windows RTX 3080 run reports much better synchronization, at the cost of copying picture buffers on holds and adding a switch and decoder state. **Should fix (1)**: not blocking, but worth doing before merging. - **L1** `host/nn_video.c:864`: A held acquire returns before updating the existing picture-pacing counters and timestamp. (more on the line) **Do:** Record the acquire time, gap and shown count for held buffers as well, sharing the accounting with the ordinary output path. **Testing before merging (2)** (runs on the systems it can change; it doesn't hold the recommendation) - **L2** `host/nn_video.c:856`: The default-on hold path has not been exercised on Linux or Steam Deck, where decoder and pacing behavior can differ. (more on the line) **Do:** Build on Linux and run the opening and title loop on Linux and Steam Deck, checking synchronization, holds, skips and completion. - **L3** `host/nn_video.c:859`: The full-frame copies on the movie thread have not been measured for their effect on pacing, including on slower CPUs and AMD Tier 1 systems. (more on the line) **Do:** Compare repeated base and PR opening runs on representative AMD and slower CPU hardware, including frame times, 1% lows and movie pacing. *(`@fix` does its part first: Avoid copying the previous image on each hold by retaining or reusing a safe reference to it.)* `@fix` can do L1 and L3. **Questions (1)** (not confirmed from the code; they don't hold the recommendation) - `host/nn_video.c:849`: Can the supported game have two movie decoders performing their first acquire concurrently? **Checks:** Still running: 10 checks. <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes, on the reported Windows RTX 3080 run: the picture was 0.01 s ahead at the opening’s end versus 0.73 and 0.86 s on main, and sound alignment improved from 690–830 ms late to 10 ms. The comparable table has one PR run; other platforms and the copy cost remain unmeasured. **Other systems:** The hold runs in the shared decoder path for API-read pools, independently of GPU vendor. Windows RTX was tested; Linux, Steam Deck and AMD Tier 1 hardware were not. Direct-memory pools retain the previous behavior. The change does not alter saves, audio or input. **Switches:** HOS_VIDEO_NO_HOLD is added as a developer kill switch, default off, so holding is enabled. Its table and reference rows are present. The reported Windows measurement supports the default there; its effect on the other affected systems remains to be checked. **Reviewed:** 5534c6b8a70e against b9bd74a25ed5: Read AGENTS.md, CONTRIBUTING.md, docs/dev/standards.md, the pull request template, commit messages, the complete diff, host/nn_video.c, tests/test_video_hold_early.py and the related catch-up fixture. Skimmed the switch reference, switch table, test runner and performance-report consumers. docs/review-checklist.md and ../Tooling/AGENTS.md were absent.; nothing run (a code review). **Checked and fine:** - The fixture checks the hold, its release when due, the switch, first and last pictures, and direct-memory pools. - The added switch is documented and has a switch-table row. - The change contains no committed game-derived output or generated shader files; the implementation and test commits record AI assistance. - No renderer API structure or shader was changed. **Testing:** Read-only review; no builds, tests or project scripts were run. The author reports an in-game Windows RTX 3080 run and game-free checks; CI is still running. **Overlaps and merge order:** Not checked; the network is closed. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by HumanBean. Nothing was run; a maintainer decides.</sub>
@ -837,0 +853,4 @@
const int from_slot = d->shown_slot - 1;
const Pool *from = from_slot >= 0 && from_slot < MAX_SLOTS && d->slot_pts[from_slot] == d->last_pts
? (const Pool *)host_of(d->slots[from_slot], POOL_MAGIC) : NULL;
if (!no_hold && d->clock_set && d->out_ns && !h->last && h->pts - d->clock_pts > hos_now_ns() - d->clock_ns + early &&
Member

L2 (should fix): The default-on hold path has not been exercised on Linux or Steam Deck, where decoder and pacing behavior can differ.

When: A Linux or Deck player can reach this shared decoder path, but the reported Windows run cannot show whether the opening and looping title stay synchronized and progress correctly there.

Do: Build on Linux and run the opening and title loop on Linux and Steam Deck, checking synchronization, holds, skips and completion.

**L2** (should fix): The default-on hold path has not been exercised on Linux or Steam Deck, where decoder and pacing behavior can differ. *When:* A Linux or Deck player can reach this shared decoder path, but the reported Windows run cannot show whether the opening and looping title stay synchronized and progress correctly there. **Do:** Build on Linux and run the opening and title loop on Linux and Steam Deck, checking synchronization, holds, skips and completion.
@ -837,0 +856,4 @@
if (!no_hold && d->clock_set && d->out_ns && !h->last && h->pts - d->clock_pts > hos_now_ns() - d->clock_ns + early &&
to && from && to->read_by_api && from->read_by_api && to->w == from->w && to->h == from->h && to->nv12 && from->nv12) {
if (to != from) {
memcpy(to->nv12, from->nv12, (size_t)to->w * to->h * 3 / 2);
Member

L3 (should fix): The full-frame copies on the movie thread have not been measured for their effect on pacing, including on slower CPUs and AMD Tier 1 systems.

When: Each hold copies about 3 MB for a 1080p NV12 image, and can also copy RGBA. The reported run counts 89 holds but does not measure their frame-time or movie-thread cost, so it cannot rule out visible stalls on slower systems.

Do: Compare repeated base and PR opening runs on representative AMD and slower CPU hardware, including frame times, 1% lows and movie pacing.

**L3** (should fix): The full-frame copies on the movie thread have not been measured for their effect on pacing, including on slower CPUs and AMD Tier 1 systems. *When:* Each hold copies about 3 MB for a 1080p NV12 image, and can also copy RGBA. The reported run counts 89 holds but does not measure their frame-time or movie-thread cost, so it cannot rule out visible stalls on slower systems. **Do:** Compare repeated base and PR opening runs on representative AMD and slower CPU hardware, including frame times, 1% lows and movie pacing.
@ -837,0 +861,4 @@
if (rgba) memcpy(to->rgba, from->rgba, (size_t)to->w * to->h * 4);
to->rgba_stale = !rgba;
}
d->slot_pts[slot] = d->last_pts, d->slot_last[slot] = 0, d->busy[slot] = 1, d->shown_slot = slot + 1;
Member

L1 (should fix): A held acquire returns before updating the existing picture-pacing counters and timestamp.

When: When several successive acquires repeat a picture, the next new picture is measured from the last new picture instead of the last acquire. The reported longest wait and late-picture count can therefore indicate a 50 ms or longer delivery gap even though the game received repeated buffers in between, and the shown count omits those buffers.

Do: Record the acquire time, gap and shown count for held buffers as well, sharing the accounting with the ordinary output path.

**L1** (should fix): A held acquire returns before updating the existing picture-pacing counters and timestamp. *When:* When several successive acquires repeat a picture, the next new picture is measured from the last new picture instead of the last acquire. The reported longest wait and late-picture count can therefore indicate a 50 ms or longer delivery gap even though the game received repeated buffers in between, and the shown count omits those buffers. **Do:** Record the acquire time, gap and shown count for held buffers as well, sharing the accounting with the ordinary output path.
Owner
@fix
fix(video): count held pictures in delivery pacing
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
Website / Website on Cloudflare (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 22s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 38s
CI / Workflow lint (actionlint) (pull_request) Successful in 40s
Third-party parts / As their notes say (pull_request) Successful in 45s
PR description / Description follows the template (pull_request_target) Failing after 27s
CI / Website build and checks (pull_request) Successful in 11m8s
c1a5e86f8c
As the review on #2264 asked.
BeanBot left a comment

Recommendation: Approve. The code is ready: only testing is left. The reported Windows run shows the picture and sound aligning, but Linux and Steam Deck playback and the pacing cost of frame copies remain unmeasured. The current accounting change also awaits verification. Recommend approval; not approved on the forge.

What @fix changed
I changed this pull request: the new head is c1a5e86f8c. I merged main (6acae6aa87) into it, as it has merge commits. I edited its description to match the change.

Changed

  • Account for held picture deliveries: Shared delivery timing and counters between held and new pictures in host/nn_video.c:930, and added coverage for successive holds in tests/test_video_hold_early.py:84. Tests were not run, as instructed.

Not done

  • Avoid frame copies on holds, host/nn_video.c:859: A safe shared image lifetime is still needed across pool writes and finalization. The author must also measure pacing on slower CPUs and AMD Tier 1 systems.

Nothing was built or run: the checks run again on the new head.

The change holds early movie pictures and repeats the previous picture, reducing the reported opening's sound-to-picture offset at the cost of occasional full-frame copies.

Testing before merging (2) (runs on the systems it can change; it doesn't hold the recommendation)

  • L2 host/nn_video.c:856: The default-on hold path has not been exercised on Linux or Steam Deck, where decoder and pacing behavior can differ. When: A Linux or Deck player can reach this shared decoder path, but the reported Windows run cannot show whether the opening and looping title stay synchronized and progress correctly there. Do: Build on Linux and run the opening and title loop on Linux and Steam Deck, checking synchronization, holds, skips and completion.
  • L3 host/nn_video.c:859: The full-frame copies on the movie thread have not been measured for their effect on pacing, including on slower CPUs and AMD Tier 1 systems. When: Each hold copies about 3 MB for a 1080p NV12 image, and can also copy RGBA. The reported run counts 89 holds but does not measure their frame-time or movie-thread cost, so it cannot rule out visible stalls on slower systems. Do: Compare repeated base and PR opening runs on representative AMD and slower CPU hardware, including frame times, 1% lows and movie pacing.

Checks: they run again on this head; a failure shows on the pull request.

Also noticed (3; not asked for, not blocking)
  • The current base-to-head diff also contains merged main changes beyond the movie fix.
  • The current held-delivery accounting and its added checks have not yet been verified.
  • The supplied base-to-head diff includes many merged-main changes beyond the listed PR files.
More: does it help, other systems, switches, what was read

Does it help: Yes on the tested Windows RTX 3080: the description reports sound 690–830 ms late on main versus 10 ms late with the earlier PR build. The current accounting change has not been run, and only one comparable after run is reported.

Other systems: The decoder path also runs on Linux and Steam Deck; neither has a reported playback run. Copy costs on slower CPUs and AMD Tier 1 hardware remain unmeasured.

Switches: HOS_VIDEO_NO_HOLD is added as a kill switch, default off, so holding is enabled. The Windows result supports that default there; Linux, Steam Deck and AMD results are pending. The switch table and reference document have entries.

Reviewed: c1a5e86f8c against 6acae6aa87: Read the repository rules, standards, PR template, the video acquisition and reporting paths, the hold test, switch entries, and BeanBot's diff. Skimmed the larger base-to-head diff and commit list; it contains many merged-main files beyond the four listed PR files, which were not read in full. docs/review-checklist.md and the adjacent Tooling rules file were absent.; nothing run (a code review).

Checked and fine:

  • Held deliveries reach the shared timing and counter updates while leaving the early picture queued.
  • BeanBot's accounting change preserves the hold path and its kill switch.

Testing: No commands that build or run tests were executed. The description reports earlier Windows gameplay and game-free checks; CI has not run on the current head.

Overlaps and merge order: Not checked; the network is closed.


Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.

**Recommendation: Approve.** The code is ready: only testing is left. The reported Windows run shows the picture and sound aligning, but Linux and Steam Deck playback and the pacing cost of frame copies remain unmeasured. The current accounting change also awaits verification. Recommend approval; not approved on the forge. **What `@fix` changed** I changed this pull request: the new head is c1a5e86f8c36. I merged `main` (6acae6aa8752) into it, as it has merge commits. I edited its description to match the change. **Changed** - **Account for held picture deliveries**: Shared delivery timing and counters between held and new pictures in host/nn_video.c:930, and added coverage for successive holds in tests/test_video_hold_early.py:84. Tests were not run, as instructed. **Not done** - **Avoid frame copies on holds, host/nn_video.c:859**: A safe shared image lifetime is still needed across pool writes and finalization. The author must also measure pacing on slower CPUs and AMD Tier 1 systems. Nothing was built or run: the checks run again on the new head. The change holds early movie pictures and repeats the previous picture, reducing the reported opening's sound-to-picture offset at the cost of occasional full-frame copies. **Testing before merging (2)** (runs on the systems it can change; it doesn't hold the recommendation) - **L2** `host/nn_video.c:856`: The default-on hold path has not been exercised on Linux or Steam Deck, where decoder and pacing behavior can differ. *When:* A Linux or Deck player can reach this shared decoder path, but the reported Windows run cannot show whether the opening and looping title stay synchronized and progress correctly there. **Do:** Build on Linux and run the opening and title loop on Linux and Steam Deck, checking synchronization, holds, skips and completion. - **L3** `host/nn_video.c:859`: The full-frame copies on the movie thread have not been measured for their effect on pacing, including on slower CPUs and AMD Tier 1 systems. *When:* Each hold copies about 3 MB for a 1080p NV12 image, and can also copy RGBA. The reported run counts 89 holds but does not measure their frame-time or movie-thread cost, so it cannot rule out visible stalls on slower systems. **Do:** Compare repeated base and PR opening runs on representative AMD and slower CPU hardware, including frame times, 1% lows and movie pacing. **Checks:** they run again on this head; a failure shows on the pull request. <details> <summary>Also noticed (3; not asked for, not blocking)</summary> - The current base-to-head diff also contains merged main changes beyond the movie fix. - The current held-delivery accounting and its added checks have not yet been verified. - The supplied base-to-head diff includes many merged-main changes beyond the listed PR files. </details> <details> <summary>More: does it help, other systems, switches, what was read</summary> **Does it help:** Yes on the tested Windows RTX 3080: the description reports sound 690–830 ms late on main versus 10 ms late with the earlier PR build. The current accounting change has not been run, and only one comparable after run is reported. **Other systems:** The decoder path also runs on Linux and Steam Deck; neither has a reported playback run. Copy costs on slower CPUs and AMD Tier 1 hardware remain unmeasured. **Switches:** HOS_VIDEO_NO_HOLD is added as a kill switch, default off, so holding is enabled. The Windows result supports that default there; Linux, Steam Deck and AMD results are pending. The switch table and reference document have entries. **Reviewed:** c1a5e86f8c36 against 6acae6aa8752: Read the repository rules, standards, PR template, the video acquisition and reporting paths, the hold test, switch entries, and BeanBot's diff. Skimmed the larger base-to-head diff and commit list; it contains many merged-main files beyond the four listed PR files, which were not read in full. docs/review-checklist.md and the adjacent Tooling rules file were absent.; nothing run (a code review). **Checked and fine:** - Held deliveries reach the shared timing and counter updates while leaving the early picture queued. - BeanBot's accounting change preserves the hold path and its kill switch. **Testing:** No commands that build or run tests were executed. The description reports earlier Windows gameplay and game-free checks; CI has not run on the current head. **Overlaps and merge order:** Not checked; the network is closed. </details> --- <sub>Automated code review by BeanBot (gpt-6.1-terra), asked for by BeanBot, after its fix. Nothing was run; a maintainer decides.</sub>
HumanBean changed title from WIP: fix(video): a movie's picture waits for its clock, so its sound is no longer late at 240 fps to fix(video): a movie's picture waits for its clock, so its sound is no longer late at 240 fps 2026-11-23 16:10:14 +00:00
HumanBean deleted branch fix/movie-pace-av-sync 2026-11-23 16:11:41 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!2264
No description provided.