Repository navigation
Audio export: reject Opus packets that cross AWC block boundaries - #5498
gregoirener wants to merge 2 commits into
Conversation
|
AI-assisted review of 857b975 on Windows 11. A retry in an existing output folder retains a partial Ogg from the previous exporter. The same input produces a different file set in an empty folder. To reproduce, use the synthetic bank in parent = runpy.run_path(str(Path(parent_worktree) / "tools/awc_opus.py"))
parent["export_bank"](str(bank), str(root / "out"))Import Parent 3faac55 writes a 130-byte Please cover the retry after an upgrade. If the exporter must preserve existing files, report the conflicting output so a caller can distinguish it from a clean export. All 49 existing Opus tests pass on this head. |
|
The stricter block check preserved every packet list I compared on Xbox 1.0.2.1. I scanned 71,676 AWC banks across the complete audio, story000, shared_minigame000 and story000_restofworld archives, passing the same bank bytes to the parent reader and
I also ran the PR’s metadata-only music path on every descriptor. Its channel metadata matched the parent’s full reader after omitting the packet lists. This tests compatibility at the reader boundary; I didn't write Ogg files or exercise retries in an existing output directory. CachyOS, CPU only, AI-assisted (OpenAI Codex). |
|
Independent verification on Windows 11 (Python 3.14.7, head
Looks good to merge. AI-assisted. |
|
Tested 857b975 on Linux (Python 3.14.4, CPU only, synthetic banks, no ffmpeg). AI-assisted.
One thing synthetic banks cannot show: the |
|
I reproduced the retry case reported by @shdann. Commit On macOS with Python 3.14 in isolated mode, 49 Opus, 18 manifest, 13 shorts, and 12 audio-stage resume tests passed. The packet acceptance check is unchanged from the head that @Kev-Ball compared against the corpus. AI-assisted. |
Kam471
left a comment
There was a problem hiding this comment.
Head d6db02a1c68a · Verdict: LGTM
python -I -m pytest tests/test_awc_opus.py -q → 49 passed, 34 subtests. git diff --check clean.
opus_packets returns None on a packet crossing a 2048-byte block; the exporter keeps an existing Ogg with a warning and the music path warns too. Nit: a non-music stream with a crossing packet and no existing Ogg is silently counted as other (no diagnostic); consider one. No blockers.
|
Tested d6db02a merged with main 561b65a on Linux (WSL2) / Python 3.12.16: pass tests/test_awc_opus.py: 57 run, 57 passed, 0 failed; the other awc/opus tests (test_awc_manifest, test_awc_markers, test_awc_names, test_awc_shorts, test_opus_tags) also pass. Negative control: with tools/awc_opus.py restored from upstream/main the two new tests (test_packet_crossing_block_does_not_publish_partial_opus, test_streamed_packet_crossing_block_keeps_pcm_sibling) fail (57 run, 2 failures); fix restored afterwards. opus_packets has no caller outside awc_opus.py, so the new None return is handled at both call sites (export_bank and music_channels). This changes behaviour for any real bank with a packet crossing a 2048-byte block: it used to publish a truncated Ogg and now publishes none (warning on stderr, existing Ogg kept); I only checked it with the synthetic banks in the tests, not against real banks. |
shayderrr
left a comment
There was a problem hiding this comment.
Review
Reviewed change in PR #5498: Audio export: reject Opus packets that cross AWC block boundaries.
Scope: tests/test_awc_opus.py, tools/awc_opus.py
Diff: +63 / -4 across 2 file(s).
The change stays inside the stated scope and the touched files line up with the description. No unrelated production paths are pulled in, and the stated behavior is directly exercised by the diff. I'm approving this one.
Reviewed by shayderrr via automated batch review.
|
Thanks @gregoirener - I went through Audio export: reject Opus packets that cross AWC block boundaries and the diff around |
Claimed as AWC-OPUS-PACKET-BOUNDS in coordination issue #5361.
What and why
make_game.pyrunsawc_opus.pyin its assets stage. An AWC packet length that crosses its 2048-byte block was treated like a zero-length padding marker. The exporter could publish a shorter Ogg from the packets before the malformed length and count the stream as exported.The packet reader now distinguishes valid zero-length padding from a length that overruns the block. Plain Opus export leaves out the affected stream. Streamed music rejects the affected descriptor in both export and metadata modes, using the same behavior as an invalid block layout or repeated-packet declaration. Tests reproduce both cases and check that a sibling PCM stream is still written.
Tested
Python 3.14.0 in isolated mode on macOS. Synthetic banks and FFmpeg-generated audio, CPU only. GPU and driver are not applicable.
python -I tests/test_awc_opus.py— 49 passed. Both new tests failed on main and passed with the fix.python -I tests/test_awc_manifest.py— 18 passed.python -I tests/test_audio_stage_resume.py— 12 passed.python -I tests/test_audio_wav.py— 36 passed, 4 skipped.python -I -m compileall -q make_game.py tools testsandpython -I scripts/check_no_game_data.py— passed.AI-assisted: yes.