Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(ios) avoid reapplying config when audio category doesn't change

Saúl Ibarra Corretgécc5f65f58f9d
diff --git a/ios/sdk/src/AudioMode.m b/ios/sdk/src/AudioMode.m
index f2804d544e..9ca20cf4a7 100644
--- a/ios/sdk/src/AudioMode.m
+++ b/ios/sdk/src/AudioMode.m
@@ -259,10 +259,16 @@ RCT_EXPORT_METHOD(updateDeviceList) {
self->forceSpeaker = NO;
self->forceEarpiece = NO;
break;
- case AVAudioSessionRouteChangeReasonCategoryChange:
+ case AVAudioSessionRouteChangeReasonCategoryChange: {
// The category has changed. Check if it's the one we want and adjust as
// needed.
+ RTCAudioSessionConfiguration *currentConfig = [self configForMode:self->activeMode];
+ if ([session.category isEqualToString:currentConfig.category]) {
+ // We are in the desired category, nothing to do here.
+ return;
+ }
break;
+ }
default:
return;
}
@@ -275,7 +281,6 @@ RCT_EXPORT_METHOD(updateDeviceList) {
RTCAudioSessionConfiguration *config = [self configForMode:self->activeMode];
[self setConfig:config error:nil];
if (self->forceSpeaker && !self->isSpeakerOn) {
- RTCAudioSession *session = JitsiAudioSession.rtcAudioSession;
[session lockForConfiguration];
[session overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:nil];
[session unlockForConfiguration];
@@ -358,7 +363,7 @@ RCT_EXPORT_METHOD(updateDeviceList) {
break;
}
}
-
+
for (AVAudioSessionPortDescription *portDesc in session.availableInputs) {
// Skip "Phone" if headphones are present.
if (headphonesAvailable && [portDesc.portType isEqualToString:AVAudioSessionPortBuiltInMic]) {