Skip to content

Don't hard-assert on AVAudioSession category-change failures during call teardown#6303

Open
hkarmoush wants to merge 1 commit into
signalapp:mainfrom
hkarmoush:fix/6246-call-audio-session-teardown-crash
Open

Don't hard-assert on AVAudioSession category-change failures during call teardown#6303
hkarmoush wants to merge 1 commit into
signalapp:mainfrom
hkarmoush:fix/6246-call-audio-session-teardown-crash

Conversation

@hkarmoush

Copy link
Copy Markdown

Contributor checklist

  • I have read the README and CONTRIBUTING documents
  • I have signed the Contributor Licence Agreement
  • My commits are rebased on the latest main branch
  • My commits are in nice logical chunks
  • My contribution is fully baked and is ready to be merged as is
  • I have tested my contribution on these devices:
  • iPhone, iOS 18

Description

Fixes #6246.

CallAudioService.setAudioSession(category:mode:options:) wraps AVAudioSession.setCategory and, on failure, calls owsFailDebug. 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 .ambient when 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 owsFailDebug to Logger.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.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Debug build crashes on Call Link end: owsFailDebug fires when AVAudioSession.setCategory throws during call teardown

1 participant