fix(ajm): preserve live decoder handles across ID wrap #6051
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6051"
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?
Imported from boykopovar/AnyPS5. Originally posted by Ondra97 on 2026-10-14T20:54:08Z.
What
Creating a decoder can replace a live AJM instance when the 14-bit slot counter wraps. On main, keeping two initialized Opus decoders while creating and destroying temporary decoders reuses a retained handle after 16,383 temporary creations. Its next empty-input job reports not-initialized and writes 0 bytes, while the retained reference decoder drains the expected 3328 bytes of PCM.
sceAjmInstanceCreatenow searches the existing slot namespace underg_lockand inserts only at a free ID. A full namespace returns the existingOUT_OF_RESOURCESresult and leaves the caller's output untouched. The codec prefix and slot zero are preserved. The exhaustion result follows the PS4 reimplementation linked in technical debt; the runtime's slot count and PS5 capacity/result are explicitly distinguished there.Tested
Windows 11 Pro build 26300, WinLibs MinGW-w64 GCC 15.2.0 UCRT POSIX SEH r7, Release,
BUILD_TESTING=ON, fullbuild-runtimeconfiguration.03ab6c494, unchanged production: standalone public-API reproduction loses pending PCM after the duplicate handle (94 ms). The new registeredguest_ajmregression fails withAJM creation replaced an existing live decoder handle(0.21 s).41cc655b8. The final 33 audio/runtime tests and patched-library audit passed 33/33 in 5.49 s, without skips. Conventions, whitespace, test registration and the repository overlap checker passed.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)Imported from boykopovar/AnyPS5. Originally posted by coltken95 on 2026-10-15T00:41:38Z.
Tested on Linux x86-64 (Release build), with
e60dd9d5amerged into mainab9a47684:guest_ajmpasses.libSceAjm.native/src/Ajm.cpp:guest_ajmaborts withterminate called after throwing an instance of 'std::runtime_error' what(): AJM creation replaced an existing live decoder handle.AI-assisted: yes (Claude Code)
Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-15T12:13:54Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)docs/dev/debt/libSceAjm.native.mdL4Some 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.
core/libs/tests/GuestAjm.cppcore/libs/prx/libSceAjm.native/src/Ajm.cppcore/libs/tests/GuestAjm.cppdocs/dev/debt/libSceAjm.native.mdImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-16T21:20:56Z.
Checked on Linux: the build and scoped ctest (37 tests) pass, including
guest_ajm. With theAjm.cppchange reverted,guest_ajmfails. The merge with currentmainis clean. The newOUT_OF_RESOURCESbehaviour is documented as unverified on PS5 indocs/dev/debt/libSceAjm.native.md. Merging.