|
@@ -125,12 +125,19 @@ RCT_EXPORT_MODULE();
|
125
|
125
|
return _workerQueue;
|
126
|
126
|
}
|
127
|
127
|
|
|
128
|
+- (BOOL)setConfigWithoutLock:(RTCAudioSessionConfiguration *)config
|
|
129
|
+ error:(NSError * _Nullable *)outError {
|
|
130
|
+ RTCAudioSession *session = [RTCAudioSession sharedInstance];
|
|
131
|
+
|
|
132
|
+ return [session setConfiguration:config error:outError];
|
|
133
|
+}
|
|
134
|
+
|
128
|
135
|
- (BOOL)setConfig:(RTCAudioSessionConfiguration *)config
|
129
|
136
|
error:(NSError * _Nullable *)outError {
|
130
|
137
|
|
131
|
138
|
RTCAudioSession *session = [RTCAudioSession sharedInstance];
|
132
|
139
|
[session lockForConfiguration];
|
133
|
|
- BOOL success = [session setConfiguration:config error:outError];
|
|
140
|
+ BOOL success = [self setConfigWithoutLock:config error:outError];
|
134
|
141
|
[session unlockForConfiguration];
|
135
|
142
|
|
136
|
143
|
return success;
|
|
@@ -196,7 +203,7 @@ RCT_EXPORT_METHOD(setAudioDevice:(NSString *)device
|
196
|
203
|
break;
|
197
|
204
|
}
|
198
|
205
|
}
|
199
|
|
-
|
|
206
|
+
|
200
|
207
|
if (port != nil) {
|
201
|
208
|
// First remove the override if we are going to select a different device.
|
202
|
209
|
if (isSpeakerOn) {
|
|
@@ -206,11 +213,11 @@ RCT_EXPORT_METHOD(setAudioDevice:(NSString *)device
|
206
|
213
|
// Special case for the earpiece.
|
207
|
214
|
if ([port.portType isEqualToString:AVAudioSessionPortBuiltInMic]) {
|
208
|
215
|
forceEarpiece = YES;
|
209
|
|
- [self setConfig:earpieceConfig error:nil];
|
|
216
|
+ [self setConfigWithoutLock:earpieceConfig error:nil];
|
210
|
217
|
} else if (isEarpieceOn) {
|
211
|
218
|
// Reset the config.
|
212
|
219
|
RTCAudioSessionConfiguration *config = [self configForMode:activeMode];
|
213
|
|
- [self setConfig:config error:nil];
|
|
220
|
+ [self setConfigWithoutLock:config error:nil];
|
214
|
221
|
}
|
215
|
222
|
|
216
|
223
|
// Select our preferred input.
|