Repository navigation
SDL: reopen an AAudio stream disconnected while in the background - #96
Merged
Merged
Conversation
…d on resume, not left silent Android may disconnect an app's AAudio (MMAP) stream while SDL has it paused in the background. On resume SDL 3.4.16's AAUDIO_ResumeDevices only logs requestStart's failure (-895, "stream is disconnected"); a paused stream gets no error callback, so the device thread never rebuilds it and the game stays silent until restarted (Odin 3, after switching apps). The patch flags that failure as the error callback would, and PlayDevice opens a new stream. Applied by android/deps/build_deps.sh after unpacking SDL. Co-Authored-By: Claude Opus 5.5 <[email protected]>
mamcjr
marked this pull request as ready for review
November 3, 2026 11:13
mamcjr
added a commit
that referenced
this pull request
Nov 3, 2026
…103, #187, #96) Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
After switching away from the game and back, it can stay silent until it is restarted. Seen on an AYN Odin 3 (Adreno 830, Android, 1.8.2) after ~2.5 h of play with an app switch in between:
The game kept rendering at 60 fps while the system reported its AAudio player as
paused.Android can disconnect an AAudio (MMAP) stream while SDL holds it paused in the background. On resume, SDL 3.4.16's
AAUDIO_ResumeDevicesonly logsrequestStart's failure. A paused stream gets no error callback, soAAUDIO_PlayDevicenever reachesRecoverAAudioDeviceand nothing reopens the stream.Fix
android/deps/sdl-aaudio-resume.patch: whenrequestStartfails on resume, seterror_callback_triggeredand signal the device semaphore, as the error callback does. The device thread then rebuilds the stream through SDL's existing recovery path.build_deps.shapplies the patch after unpacking SDL (deleteout/lib/libSDL3.soto rebuild).Testing
requestStartreturns 0, playerstarted).🤖 Generated with Claude Code