Finish WAV capture at the RIFF size limit #4991
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!4991
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-4990"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@RanoGames on GitHub · 2026-12-01 16:46 UTC · original
RanoGames:fix/wav-riff-size-limit→main· +36 −9 · 1 files · 1 commits · openWhat it changes
The diagnostics recorder writes 48 kHz stereo PCM with four bytes per frame. After about 6 h 13 min the PCM payload still fits a
u32, but adding the 36 bytes counted by the RIFF chunk size overflows. Longer recordings can continue past the length their WAV header describes.Finish at the last whole PCM frame representable by RIFF, including when a timestamp gap consumes the remaining space. Release the full WASAPI packet and write the final header before returning. Stream silence for gaps in bounded chunks.
How it was tested
5fabb46ethe extracted header function panicked on integer overflow. On7a922141theRIFFanddatalengths matched the last whole frame.cargo test --locked -p victory-hle --features diagnostics --lib modules::audio::capture::testspassed (1 test).cargo clippy --locked -p victory-hle --lib --features diagnostics --no-deps -- -D warningspassed. No six-hour hardware recording or game run was performed.Checked for overlap
VICTORY_AUDIO_CAPTURE, and reviewed changes to the recorder. #4725 addresses recorder scheduling and #4825 addresses unreliable WASAPI timestamps. Both retain the original RIFF length calculation.@cloph-dsp on GitHub · 2026-12-01 17:33 UTC · original
Verification (independent, AI-assisted: Hy4 flash). Windows, Rust 1.100.0 (Scoop rust-msvc), MSVC, commit-scoped shallow worktree.
Base
5fabb46eaf6ed8771321787f8871051abde69b9b, head7a92214160437d0b17cecd7e5af2d2f5de3c44ad.git diff --numstat→ crates/victory-hle/src/modules/audio/capture.rs 36/9.The test is new on the base (
git grep -F wav_sizes_stop_at_the_last_whole_frame_that_fits_riff 5fabb46e -- .→ no match, exit 1).One build note, because it costs a run:
captureis declared#[cfg(all(windows, feature = "diagnostics"))](modules/audio.rs:28), so without--features diagnosticsthe module is not compiled andcargo test -p victory-hle --lib -- --listshows no such test at all — a silent absence, not a failure.git diff --check "5fabb46e..7a922141"→ no output, exit 0.Result:
running 1 test,test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 482 filtered out.What it pins:
header(frames)for 1, max_frames-1, max_frames, max_frames+1 and max_frames+10 withmax_frames = (u32::MAX - 36) / FRAME_BYTES, asserting the data chunk ismin(frames, max_frames) * FRAME_BYTESand that the RIFF size is36 + data. Pure header arithmetic, no file written, no audio device opened; GPU/driver N/A. No game data.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.