victory-hle(apu): reuse Opus decode scratch buffer and pre-reserve result queue #2423
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2423
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2423"
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?
@faycalbaklouti on GitHub · 2026-11-25 13:14 UTC · original
faycalbaklouti:fix/apu-opus-scratch-buffer→main· +158 −6 · 1 files · 1 commits · openTarget upstream:
Marvisak/VIctory(also applies cleanly toBelobug/VIctory-Belobug-AMDandfxceless/victory-fork)Problem
The Opus audio decode path in
crates/victory-hle/src/modules/apu.rsallocated fresh per-packet scratch buffers and grew the result queue dynamically on every decode batch, creating unnecessary heap churn on the audio thread.Solution
Verification
git apply --checkpasses cleanly onMarvisak/VIctorymain(direct zero-conflict apply).About our fork & censorship-resistant preservation effort:
This fix comes from gta6-vi-port, our open-source Linux (GE-Proton) + NVIDIA RTX 4090 fork of VIctory and peer-to-peer Radicle archival effort (mirroring 92+ community porting repositories across public Radicle seeds so open-source porting research survives centralized takedowns; open-source code only, no game files/keys/binaries).
rad:z39ofPhQC1siudH9BF3xsmAMmUqxc).onionVP9+Opus viewer:http://kwnoaeecpmxd6eetqfa7fxlymvxnh5du2i6wxr44t4mc7cgch5pw23id.onion/)@Marvisak on GitHub · 2026-11-25 15:32 UTC · original
Automated triage for the maintainers.
Needs work. This keeps a reused
decode_bufin the APUStateinstead of allocatingMAX_FRAMES * channelsfloats per packet inprocess(crates/victory-hle/src/modules/apu.rs), and givesresultsa starting capacity ofstreams * commands_per_stream. The logic is fine and it resizes for streams with more channels. What would change the verdict:process_reuses_decode_scratch_buffer_without_reallocatingasserts the buffer's pointer and capacity stay the same, which is the implementation, not behaviour. The existing decode tests already cover correctness.streams * commands_per_stream); please cap it or keepVecDeque::new().CI: passing.
Generated by Claude Code
@kotekompotek on GitHub · 2026-11-25 16:53 UTC · original
Sound:
decode_bufis behind the connection mutex (streams can't race on it),neededfalls back toresizefor >2-channel decoders (Opus supports up to 8 —MAX_PCM_SAMPLESonly pre-sizes stereo, not a cap), and the borrow is disjoint (state.streams[x]decoder vsstate.decode_buf).resultspre-reserve matches the documented max queue depth. Test verifies capacity retention — good regression pin.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.