From 966f8dc9a29d88960d84235a590f7e9b51891884 Mon Sep 17 00:00:00 2001 From: Guillaume BIENKOWSKI Date: Fri, 4 Jul 2014 12:31:17 +0200 Subject: [PATCH] Don't re-enable the speaker in video if the user disabled it. This can happen when there's an ICE reinvite. --- Classes/LinphoneManager.m | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index 3a5927891..a02a9774d 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -643,8 +643,13 @@ static void linphone_iphone_display_status(struct _LinphoneCore * lc, const char } } + // we keep the speaker auto-enabled state in this static so that we don't + // force-enable it on ICE re-invite if the user disabled it. + static BOOL speaker_already_enabled = FALSE; + // Disable speaker when no more call if ((state == LinphoneCallEnd || state == LinphoneCallError)) { + speaker_already_enabled = FALSE; if(linphone_core_get_calls_nb(theLinphoneCore) == 0) { [self setSpeakerEnabled:FALSE]; [self removeCTCallCenterCb]; @@ -695,8 +700,9 @@ static void linphone_iphone_display_status(struct _LinphoneCore * lc, const char state == LinphoneCallOutgoingInit || state == LinphoneCallConnected || state == LinphoneCallStreamsRunning) { - if (linphone_call_params_video_enabled(linphone_call_get_current_params(call))) { + if (linphone_call_params_video_enabled(linphone_call_get_current_params(call)) && !speaker_already_enabled) { [self setSpeakerEnabled:TRUE]; + speaker_already_enabled = TRUE; } } if (state == LinphoneCallConnected && !mCallCenter) {