Don't hard-assert on AVAudioSession category-change failures during call teardown#6303
Open
hkarmoush wants to merge 1 commit into
Open
Don't hard-assert on AVAudioSession category-change failures during call teardown#6303hkarmoush wants to merge 1 commit into
hkarmoush wants to merge 1 commit into
Conversation
CallAudioService.setAudioSession(category:mode:options:) treats any AVAudioSession.setCategory failure as owsFailDebug, which crashes debug/internal builds. One of its callers reverts to ambient audio when a call ends, including Call Link calls. If the OS rejects the category change while the session is being torn down, that's an expected, transient condition rather than a programmer error, so it shouldn't hard-assert. Log it instead. Fixes signalapp#6246
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.
Contributor checklist
Description
Fixes #6246.
CallAudioService.setAudioSession(category:mode:options:)wrapsAVAudioSession.setCategoryand, on failure, callsowsFailDebug. That's a hard assertion — it trips a debugger breakpoint or crashes outright on debug/internal builds.One of the paths that calls into this is
ensureProperAudioSession, which reverts the session to.ambientwhen a call ends — including Call Link calls. If the OS rejects the category change while the audio session is mid-teardown, that's an expected, transient condition, not a programmer error. Treating it as one crashes the app on exactly the kind of build (debug/internal) contributors and QA rely on to catch real bugs, which just trains people to ignore it or makes debug builds unusable around call teardown.This PR downgrades that one failure path from
owsFailDebugtoLogger.error, keeping the exact same diagnostic message so nothing is lost from the logs — it just stops being fatal. Nothing else about the method changes; the delegate callback right after the catch block still fires as before.Tested by placing and ending a Call Link call on a physical iPhone (iOS 18) and confirming no crash on teardown.