Browse Source

Fix treating the local session as a remote session when the HPB is used

When processing the participants in a room the signaling sessions of the
participants were compared against the Nextcloud session of the local
participant to find out which were the remote sessions. However, when
the HPB is used the signaling session is not the same as the Nextcloud
session, so the signaling session of the local participant never matched
her Nextcloud session, so it was always seen as a remote participant.

This caused the call state to be changed to "in conversation" (which,
for example, stopped the calling sound), when only the local participant
was in the call.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Daniel Calviño Sánchez 4 years ago
parent
commit
9687a9453d
1 changed files with 12 additions and 1 deletions
  1. 12 1
      app/src/main/java/com/nextcloud/talk/controllers/CallController.java

+ 12 - 1
app/src/main/java/com/nextcloud/talk/controllers/CallController.java

@@ -1657,8 +1657,14 @@ public class CallController extends BaseController {
 
         hasMCU = hasExternalSignalingServer && webSocketClient != null && webSocketClient.hasMCU();
 
+        // The signaling session is the same as the Nextcloud session only when the MCU is not used.
+        String currentSessiondId = callSession;
+        if (hasMCU) {
+            currentSessiondId = webSocketClient.getSessionId();
+        }
+
         for (HashMap<String, Object> participant : users) {
-            if (!participant.get("sessionId").equals(callSession)) {
+            if (!participant.get("sessionId").equals(currentSessiondId)) {
                 Object inCallObject = participant.get("inCall");
                 boolean isNewSession;
                 if (inCallObject instanceof Boolean) {
@@ -1695,6 +1701,11 @@ public class CallController extends BaseController {
             getPeersForCall();
         }
 
+        if (hasMCU) {
+            // Ensure that own publishing peer is set up.
+            getPeerConnectionWrapperForSessionIdAndType(webSocketClient.getSessionId(), "video", true);
+        }
+
         for (String sessionId : newSessions) {
             getPeerConnectionWrapperForSessionIdAndType(sessionId, "video", hasMCU && sessionId.equals(webSocketClient.getSessionId()));
         }