xma: start the frame after a continuation at the next packet that has frames #96
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!96
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/96/head"
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?
@tedin7 on GitHub · 2026-11-24 00:26 UTC · original
tedin7:vic-xma-continuation→main· +43 −4 · 1 files · 1 commits · merged 2026-11-25 00:15 UTCWhat
xma::next_framenow finds the frame after one that ends in a packet where no frame begins (headerframes == 0) by following each packet'sskipto the next packet that has frames, instead of returning the position inside that packet. Packets withframes == 0andfirst_frame_bit == 0x7fff(a frame spans all of them) are stepped over the same way.Why
When a frame crosses a continuation packet and ends in a later packet that holds only the tail of that frame plus padding,
next_framereturned the bit right after the frame, inside the padding.read_framethen read a zero length there and the walk stopped, so every later frame of the stream was lost (audio cut off early). Only the "last frame of its own packet" and "ends exactly on a packet boundary" cases jumped to the next packet.Tested
Linux x86_64 only, synthetic in-memory packets (no game data). The new test builds 4 packets: a frame crossing a full continuation packet and ending 64 bits into a packet with no frames, then a packet with one frame.
cargo test -j4 -p victory-formats --lib xma::fails the new test (left: Some(32864),right: Some(49184)).cargo test -j4 -p victory-formatsgives 18 passed, 0 failed, 3 ignored (the ignored ones need files outside the repo).cargo clippy -j4 -p victory-formats --testsis clean.cargo fmt --checkalready reports diffs in untouched code in this crate; I did not reformat it. My lines follow the surrounding wide-line style.Not run: Windows runtime, the GPU, and any real XMA stream or reference decoder (the
#[ignore]tests need files outside the repo). The packet layout in the test follows the header description in the module docs; I could not confirm against a real encoder how often it emits a tail-only packet.@DaviTostes on GitHub · 2026-11-24 01:12 UTC · original
Tested
ba42db6: pass.cargo test -p victory-formats: 18 passed, 0 failed, 3 ignored, including the 1 test this PR adds.No game data used.
@Marvisak on GitHub · 2026-11-25 00:24 UTC · original
Automated triage for the maintainers.
Merge candidate.
next_frameincrates/victory-formats/src/xma.rslooked for the next frame in a packet's padding when a frame ended partway through a packet whose header hasframes == 0, so the frame walk stopped early. It now moves on viaskipto the next packet that has frames and steps overframes == 0continuation packets the same way; this follows from the header layout in the module docs (the count is of frames that begin in the packet), and the loop ends becausepacket()returnsNonepast the data. The synthetic test checks the next-frame positions; no real stream was tested, as the PR says.CI: no check runs on the head commit.
Generated by Claude Code