From 8fa322487929397d89e22046bf95c10665492e1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Thu, 24 Oct 2024 21:37:50 +0200 Subject: [PATCH] Set "hasMCU" once its value is known MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "hasMCU" (which has always been the wrong name, because it is an SFU rather than an MCU, but it is wrong even in the signaling server so for now the legacy name is kept) was set again and again whenever the call participant list changed. Now it is set instead once its value is known, that is, when it is known that the internal signaling server is used (as no "MCU" is used in that case), or when the connection with the external signaling server is established, as its supported features are not known until then. This change should have no effect in the usages of "hasMCU", as it is used when the call participant list change, which will happen only after joining the call in the signaling server, or when sending "isSpeaking" and toggling media, in both cases guarded by "isConnectionEstablished", which will be true only once "performCall" was called or if the call is active with other participants. Signed-off-by: Daniel Calviño Sánchez --- .../com/nextcloud/talk/activities/CallActivity.kt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt b/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt index 84a746225..c6a2e9838 100644 --- a/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt @@ -1618,6 +1618,9 @@ class CallActivity : CallBaseActivity() { signalingMessageReceiver!!.addListener(localParticipantMessageListener) signalingMessageReceiver!!.addListener(offerMessageListener) signalingMessageSender = internalSignalingMessageSender + + hasMCU = false + joinRoomAndCall() } } @@ -1903,6 +1906,11 @@ class CallActivity : CallBaseActivity() { signalingMessageReceiver!!.addListener(localParticipantMessageListener) signalingMessageReceiver!!.addListener(offerMessageListener) signalingMessageSender = webSocketClient!!.signalingMessageSender + + // If the connection with the signaling server was not established yet the value will be false, but it will + // be overwritten with the right value once the response to the "hello" message is received. + hasMCU = webSocketClient!!.hasMCU() + Log.d(TAG, "hasMCU is $hasMCU") } else { if (webSocketClient!!.isConnected && currentCallStatus === CallStatus.PUBLISHER_FAILED) { webSocketClient!!.restartWebSocket() @@ -1928,6 +1936,10 @@ class CallActivity : CallBaseActivity() { when (webSocketCommunicationEvent.getType()) { "hello" -> { Log.d(TAG, "onMessageEvent 'hello'") + + hasMCU = webSocketClient!!.hasMCU() + Log.d(TAG, "hasMCU is $hasMCU") + if (!webSocketCommunicationEvent.getHashMap()!!.containsKey("oldResumeId")) { if (currentCallStatus === CallStatus.RECONNECTING) { hangup(false, false) @@ -2136,8 +2148,6 @@ class CallActivity : CallBaseActivity() { unchanged: Collection ) { Log.d(TAG, "handleCallParticipantsChanged") - hasMCU = hasExternalSignalingServer && webSocketClient != null && webSocketClient!!.hasMCU() - Log.d(TAG, " hasMCU is $hasMCU") // The signaling session is the same as the Nextcloud session only when the MCU is not used. var currentSessionId = callSession