fix(libSceAudioOut): allow state queries during output waits #2130
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2130"
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 authurtabo-byte on 2026-10-09T09:41:34Z.
What
Audio output waits hold the global port-state mutex while draining SDL audio or pacing a port without a device. A continuous FMOD output thread can therefore starve Unity's main thread in
sceAudioOutGetPortState, leaving startup stuck on a black screen.Release the state mutex during sleeps. A separate output mutex keeps output batches and closes serialized, preserving port lifetime and output order while state queries and volume updates can proceed. Queue thresholds, drain timeouts and virtual-port pacing stay the same.
Related #1486 changes sleep precision in the same helpers; it does not release the port-state mutex. This change addresses lock scope independently and needs reconciliation if both land.
Tested
Rebased onto main
f8c2f072. Fresh independent Windows Release build: last-output-time/concurrency, pad-speaker mix levels, AudioOut2 timing and latency tests all pass (4/4; 6.06 seconds); conventions pass.Windows 11, WinLibs GCC, Release. Added a concurrency regression covering single and batched output, pacing and draining, state/timestamp queries, and close during pending output. The regression fails on unchanged audio code; with this change it passes.
audio_out_last_output_time,audio_out_mix_level_pad_spk,audio_out2_timingandaudio_out2_latencypass (4/4).In MiniGolf, repeated debugger samples previously showed the main thread blocked in
sceAudioOutGetPortStatewhile FMOD slept inqueueAudioholding the shared mutex. With this change the main thread advances. Separate module-loading and rendering issues are being tested independently; this is not a claim that this change alone makes the title playable.Conventions and whitespace checks pass. Linux and other titles were not run.
Checklist
main; no duplicate open PR implements this fix (related #1486 described above)