Skip to content

[Audio Bug] Microphone fails to start on second room entry – AudioUnit error 561145187 (!pri) #17

@SailorGa

Description

@SailorGa

We encountered an audio issue when using WebRTC-SDK (version 137.7151.01) to implement video conferencing.
• On the first join to a meeting, everything works as expected;
• After leaving and rejoining the meeting, the microphone fails to start;
• Console error output:

(voice_processing_audio_unit.mm:402 Start): Failed to start audio unit. Error=561145187 (audio_device_ios.mm:335 StartRecording): StartRecording failed to start audio unit, reason 561145187

Error Analysis:

The error code 561145187 corresponds to '!pri' (kAudioUnitErr_CannotDoInCurrentContext), which means AudioUnit could not operate in the current context. Possible reasons include:
• Audio resources (e.g., AudioUnit) not released properly after first session;
• AVAudioSession was not reactivated before restarting audio;
• Audio device module may have retained static/shared state;
• Audio stack was not reset properly after background/interrupt state;

Expected Behavior:
• Microphone should work correctly on every room entry;
• Rejoining a room should not cause audio unit startup failure;

Reproduction Steps:
1. Launch the app and join a room (microphone works fine);
2. Leave the room, cleaning up PeerConnection and Factory;
3. Join the room again;
4. Observe error Failed to start audio unit and no mic input;

SDK Version & Environment:
• SDK: WebRTC-SDK 137.7151.01
• Integration: CocoaPods (source 'https://github.com/webrtc-sdk/Specs.git')
• Language: Objective-C
• Tested on: iOS 15+, real device

Suggestion / Request:

Please help check whether the SDK properly releases/cleans up the audio resources (such as AudioUnit, AVAudioSession, etc.) when leaving a room, and whether shared/static audio states persist across sessions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions