Repository navigation
fix(ajm): restart the stream total at a gapless reset - #12322
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
MarcZX10
left a comment
There was a problem hiding this comment.
The reset branch clears totalDecodedSamples alongside the segment counters, and the updated AT9/Opus tests verify the total restarts after reset but continues across a non-reset gapless update. The author reports 65/65 focused AJM/audio tests, including a negative control and the traced Ratchet & Clank title path; this was not measured on a physical PS5. Hosted Windows, conventions, intake and reporting pass. No blocking issue found on head 08fdabc2d9fa.
|
Thanks for tracing this, @Tamalero. I don't have console measurements or a title that requires the total to survive a gapless reset. #6040 fixed Opus segment clipping; its cumulative sideband expectation was not hardware-validated. Your change preserves that fix, and the traced seek failure supports restarting the total. I have no objection to updating that expectation. |
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
|
@Tamalero the change reads right to me. |
|
Windows result for head Host: Windows 11 26300, Intel i7-12700K, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh, r6), Release, This PR's own tests: The tree also carried the open PRs #12318, #12306, #12302, #12200, #12191, all merged cleanly, so the run is a joint one. Not run on a PS5. AI-assisted: yes (Claude Code), the runs and the numbers above are from this machine. |
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@oneandonlydean thanks, done in f535334: the debt entry now says "PPSA01474 counts a sought segment…", without the game name. No code change. Tested and written by Claude (AI assistant) on a contributor's machine. |
What
Ratchet & Clank: Rift Apart (PPSA01474) hangs on its title screen when it seeks a 4-channel ATRAC9 stream. The game sends
sceAjmBatchJobSetGaplessDecodewith the reset flag and a new total, then counts the new segment from the stream sideband's total decoded samples.Cause: the
SetGaplessDecodereset clearssegmentSamplesandskippedSamplesbut keepstotalDecodedSamples, so every later run reports the samples decoded before the seek as well. In the hang, the stream had decoded 10,944 samples before a seek to a 343,028-sample segment. When the voice hung, the segment had decoded 334,272 samples and the sideband reported 345,216. The game's voice reached its end 8,756 samples early (343,028 − 334,272), and the sideband claimed 2,188 samples past it (345,216 − 343,028). The two add up to 10,944. The voice then owes 140 samples it never gets, and the mixer loop holding the main thread's lock never exits. The trace and the core analysis are in #11700 (#11700 (comment)).Fix: the reset branch of
SetGaplessDecodealso setstotalDecodedSamplesto 0, for every codec. This matchesClearContextin the same file, which already zeroes it on aCONTROL_RESET, and shadPS4'sAjmInstance::Reset()(m_total_samples = 0), which runs for every job with the reset flag. Not measured on a console; the debt entry says so.Related, already fixed on
main: the constant tone I reported in #11700 was not AJM. About 20 of the title's object ports get their PCM from the same two scratch buffers, set one port after another, and AudioOut2 read every pointer atAdvance, so each port mixed the last port's grain. A local copy of each grain atsceAudioOut2PortSetAttributesremoved it (no full-scale grain in 183 one-second summaries after the title, against 119 of 119 before). #8098 fixes the same thing onmain.This changes the expectation that #6040 added to
TestOpusGaplessReset: each segment's total now restarts instead of accumulating. #6040 kept the cumulative count as a choice, without console data. @Ondra97, if you know of a title or a measurement that needs the count kept across aSetGaplessDecodereset, I'd like to hear it.Tested
Linux 7.3 (CachyOS), GCC 16.2.1, Release,
BUILD_TESTING=ON, onmain316615d.TestAt9GaplessResetRestartsTotal: a run decodes 1,024 samples, aSetGaplessDecodereset sets a 512-sample segment, and the next run must report a total of 512. A laterSetGaplessDecodewithout the reset must keep counting.Ajm.cppfrommain,guest_ajmfails. The first failure is inTestOpusGaplessReset. With the Opus calls skipped, the new test fails at its second run, which reports a total of 1,536 instead of 512.ctest -R 'ajm|audio': 65/65 passed.tools/check_conventions.py --base origin/mainpasses.main(abed035) with fix(shader): read a chased pointer's high word at its own offset #9749, fix(agc): bind a written TYPE 0 or 1 static image slot as a null storage image #10906, feat(shader): raise the sampler and sampled-pair limits past the 32-bit sampler masks #10000 and local probes. With this change as a switch, the tail rule from libSceAjm.native: Ratchet & Clank: Rift Apart hangs at the title screen because a run after the ATRAC9 gapless total decodes the last superframe's padding as a new segment #11700, and local equivalents of fix(audioout2): keep each port's grain when ports share a buffer #8098 and fix(libkernel): map AMM pages from a fragmented pool #11838 (both merged since), the title got through the title screen, save slot, difficulty and control style screens and the opening cutscene, to the first playable stage. Without this change (tail rule alone) it hung on the title screen as described above. One run each.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Tested and written by Claude (AI assistant) on a contributor's machine.