浏览代码

Merge pull request #1114 from nextcloud/fix-own-peer-handling-when-hpb-is-used

Fix own peer handling when HPB is used
Marcel Hibbe 3 年之前
父节点
当前提交
23883c582c
共有 1 个文件被更改,包括 14 次插入3 次删除
  1. 14 3
      app/src/main/java/com/nextcloud/talk/controllers/CallController.java

+ 14 - 3
app/src/main/java/com/nextcloud/talk/controllers/CallController.java

@@ -1655,8 +1655,16 @@ public class CallController extends BaseController {
         List<String> newSessions = new ArrayList<>();
         Set<String> oldSesssions = new HashSet<>();
 
+        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) {
@@ -1693,10 +1701,13 @@ public class CallController extends BaseController {
             getPeersForCall();
         }
 
-        hasMCU = hasExternalSignalingServer && webSocketClient != null && webSocketClient.hasMCU();
+        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()));
+            getPeerConnectionWrapperForSessionIdAndType(sessionId, "video", false);
         }
 
         if (newSessions.size() > 0 && !currentCallStatus.equals(CallStatus.IN_CONVERSATION)) {