Repository navigation
fix(audio): gate RunningBoard background-audio suspend on active libsimaudio stream - #19
Merged
Merged
Conversation
…ound-audio apps Previously shim_rb_audio() in host/simshim/compat/simshim.c unconditionally returned NO to runningboardd at -[RBProcess _lock_suspend]. Because x86Sim does not run mediaserverd (libsimaudio.dylib interposes CoreAudio HAL directly), runningboardd suspended UIBackgroundModes:["audio"] apps immediately upon backgrounding even while audio was actively playing. Have libsimaudio.dylib hold a SIGKILL-safe advisory flock on <state>/simaudio-out-bundle/<bundle_id>.lock while an output IO stream is active (dev_start -> dev_stop), and have shim_rb_audio() return YES when that lock is held while still returning NO to suspend idle background-audio apps (Maps, Health) once playback stops or after process exit.
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.
Root Cause
host/simshim/compat/simshim.c(shim_rb_audio) unconditionally returnedNOat-[RBProcess _lock_suspend]so idleUIBackgroundModes:["audio"]apps (Maps, Health) would be suspended and reclaimable by jetsam. However, becausex86Simdoes not bootmediaserverd(audio goes vialibsimaudio.dylibdirectly tox86sim-ctl simaudio), actively playing background-audio apps hold nomediaserverdRunningBoard assertion and were immediately suspended onapp.background.Fix
host/simaudio/simaudio.c: acquire aSIGKILL-safe advisoryflock(LOCK_EX | LOCK_NB)on<state>/simaudio-out-bundle/<bundle_id>.lock(strictly allowlisted bundle characters) during active outputdev_start()->dev_stop().host/simshim/compat/simshim.c: inshim_rb_audio(), check whether<state>/simaudio-out-bundle/<bundle_id>.lockis actively locked; returnYESwhile an output stream is playing and continue returningNOonce playback stops or the process exits.Verification
ci.yml(rust-launcher-tests,rust-mtlvk-tests,web,build / appimage) on this PR, plus Ubuntumac-build-arm64-shims.sh simaudio simshimcross-compile verification.