fix(audioout): preserve conversion state across output blocks #5558
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5558"
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 JJenkx on 2026-10-13T23:53:18Z.
What
Legacy AudioOut allows SDL to change the device format/rate and then calls SDL_ConvertAudio independently for every guest block. When the host rate differs, each conversion starts with fresh resampler state and drops the impulse response at block boundaries.
Open the SDL device with no format/rate changes allowed. SDL keeps the requested callback format and maintains a conversion stream for the native device. Remove the per-block converter; volume/channel preparation and output pacing remain in guest format. AudioOut2 already opens its device this way. The behavior is implemented in the pinned SDL device-open path.
Tested
The final Linux regression fails on the original production code with the missing impulse-tail error. It models a 48 kHz device with SDL's real conversion stream, feeds an impulse at the end of a 256-frame block, and checks that the response extends into the following block while preserving stereo levels. The fix passes for both 32 kHz and 44.1 kHz input.
Full bundled Linux Release development build passes with 32 build threads. All 13 audio/patched-library checks pass without skips. The regression uses an intercepted device backend, not a measured hardware rate mismatch. Full CI run 38330144628 passed at exact topic head
41112152d. Linux: 937 passed and 43 skipped (980 total), including the new resampling regression. Windows: 638 passed and 357 skipped (995 total). All relinker, register-context and write-watch jobs passed. GitHub conventions passed. A fresh native Quake PPSA01880 run with the fix reached 3D gameplay and closed normally after 180.98 seconds (exit 0), with imports enabled and no debugger, preload or audio tracing. The user reported that gameplay audio still sounds the same. Its source and obtained SDL rate were both 48 kHz; this fixes a separate host-conversion defect and does not resolve Quake's reported static.This review PR targets the existing JJenkx fork main at
1acfa7f78while the upstream author allowance is occupied by boykopovar/AnyPS5#4474. The independent topic retains its base's initialization code and does not require the tracing PR.Checklist
Current upstream validation
Published head
957051602c9e28ede9ee2e97ce00efed312e8279contains current maind1670009fbfdfe57f8f26ee09ced77fe6b18c2caand merges without conflicts. Conventions and whitespace checks pass. The topic's production change is unchanged by this main refresh. Previous validated build passes at12fddc733787670812529eee5f266740ae409641against main7a0c838ca48; any reused Linux results apply to their explicitly recorded earlier head/base. Latest-main full Linux and Windows validation passes for this published head; expected skips remain unvalidated.Current review refresh: head
079164e84cbf53ab5b51d2d2fe20909dbad8517cincludes upstream maina5f493f90dca348a65561aed4bb325a629d1b668. Conflicts are resolved and current conventions pass. Earlier full-build results describe the earlier head; fresh full Linux/Windows checks for this head are pending.Verified current full CI: run 38505284721 passes topic
079164e84cbf53ab5b51d2d2fe20909dbad8517cmerged into basea5f493f90dca348a65561aed4bb325a629d1b668. Linux 1060 passed/46 expected skips; Windows 730 passed/397 expected skips. Skipped cases remain unvalidated. The tested source tree matches this published topic head.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-15T11:15:36Z.
Checked the diff, built and ran the AudioOut ctest scope (17/17 pass,
audio_out_resamplingincluded). The new test fails withAudioOut.cppreverted, so it covers the fix. No remaining users ofport.specconversion state. Merging once CI is green.