Fix crashes in handleRouteChange during audio engine reset#36
Open
ptrbrynt wants to merge 5 commits into
Open
Conversation
AVAudioEngine.disconnectNodeOutput throws an NSException if the node has no output connections. After audioEngine.reset() in handleRouteChange all connections are already cleared, so the subsequent disconnectNodeOutput call in reconnectPlayerNode crashes. Guard the call by checking outputConnectionPoints first. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
outputConnectionPointsForNode throws an NSException if called after audioEngine.reset(), because reset() puts nodes into an invalid state for connection queries. Since reset() already clears all connections, reconnect the player node directly in handleRouteChange rather than going through reconnectPlayerNode (which defensively queries first). reconnectPlayerNode retains its guard for the setAudioFile path, where the engine is stopped but not reset and nodes remain attached. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
audioEngine.reset() only resets DSP node state — it does not clear connections. Calling connect() or disconnectNodeOutput() on an already- connected graph after reset() raises an NSException (the root cause of the crash reported in A5F032EC). Removing reset() and the redundant reconnect lets stop()/start() handle hardware route reconfiguration naturally. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
No description provided.