From 5375ebbc72a3d561b46ba54e58fe1f4a0f4ea33f Mon Sep 17 00:00:00 2001 From: Arnaud Ferraris Date: Tue, 9 Feb 2021 01:37:11 +0100 Subject: [PATCH] call-display: switch to default audio profile only if no other call Currently, when any call is terminated, audio profile/routing is switched to the default one. This is a problem when already into a call and getting a second one: rejecting the new call will keep the first one going, but with the wrong audio profile, making it difficult (or, on the PinePhone, impossible) to keep talking. This patch makes sure there is no other ongoing call before switching the audio mode, so that it's possible to keep the first call going even after rejecting the second one. --- src/calls-call-display.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/calls-call-display.c b/src/calls-call-display.c index fbff3cf..e9128e0 100644 --- a/src/calls-call-display.c +++ b/src/calls-call-display.c @@ -228,6 +228,7 @@ call_state_changed_cb (CallsCallDisplay *self, CallsCallState state) { GtkStyleContext *hang_up_style; + g_autoptr (GList) calls_list = NULL; g_return_if_fail (CALLS_IS_CALL_DISPLAY (self)); @@ -269,9 +270,14 @@ call_state_changed_cb (CallsCallDisplay *self, break; case CALLS_CALL_STATE_DISCONNECTED: - call_audio_select_mode_async (CALL_AUDIO_MODE_DEFAULT, - select_mode_complete, - NULL); + calls_list = calls_manager_get_calls (calls_manager_get_default ()); + /* Switch to default mode only if there's no other ongoing call */ + if (!calls_list || (calls_list->data == self->call && !calls_list->next)) + { + call_audio_select_mode_async (CALL_AUDIO_MODE_DEFAULT, + select_mode_complete, + NULL); + } break; }