File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ extension RoomPreConnect on Room {
3232 await preConnectAudioBuffer.agentReadyFuture;
3333 return result;
3434 } catch (error) {
35+ await preConnectAudioBuffer.stopRecording (withError: error);
3536 logger.warning ('[Preconnect] operation failed with error: $error ' );
3637 rethrow ;
3738 } finally {
Original file line number Diff line number Diff line change @@ -154,11 +154,8 @@ class PreConnectAudioBuffer {
154154 ));
155155 }
156156
157- Future <void > stopRecording () async {
158- if (! _isRecording) {
159- logger.warning ('Not recording' );
160- return ;
161- }
157+ Future <void > stopRecording ({Object ? withError}) async {
158+ if (! _isRecording) return ;
162159 _isRecording = false ;
163160
164161 // Cancel the stream subscription.
@@ -177,6 +174,11 @@ class PreConnectAudioBuffer {
177174
178175 _rendererId = null ;
179176
177+ // Stop native audio when errored
178+ if (withError != null ) {
179+ await webrtc.NativeAudioManagement .stopLocalRecording ();
180+ }
181+
180182 // Complete agent ready future if not already completed
181183 _agentReadyManager.complete ();
182184
You can’t perform that action at this time.
0 commit comments