From 004c7b296ad97b15d2a20d7cae0d75fe31f0ffb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Fri, 9 Apr 2021 13:55:40 +0200 Subject: [PATCH] Move "hasMCU" update to the top of the method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit "hasMCU" was used before being updated, so this caused an unneeded call to "getPeersForCall" when processing the users in the room for the first time even if the MCU is actually used. A better fix might be moving "hasMCU" to a method instead of relying on the cached value, but just moving the update to the top of the method should have no side effects (as calling "getPeersForCall" just updates "participantMap", which is unused when the MCU is used, and sets the avatars, which has no effect until the peer layout is set, which also sets the avatar), so this is good enough for now. Signed-off-by: Daniel Calviño Sánchez --- .../java/com/nextcloud/talk/controllers/CallController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/controllers/CallController.java b/app/src/main/java/com/nextcloud/talk/controllers/CallController.java index adfbe6816..85eddc3b4 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/CallController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/CallController.java @@ -1655,6 +1655,8 @@ public class CallController extends BaseController { List newSessions = new ArrayList<>(); Set oldSesssions = new HashSet<>(); + hasMCU = hasExternalSignalingServer && webSocketClient != null && webSocketClient.hasMCU(); + for (HashMap participant : users) { if (!participant.get("sessionId").equals(callSession)) { Object inCallObject = participant.get("inCall"); @@ -1693,8 +1695,6 @@ public class CallController extends BaseController { getPeersForCall(); } - hasMCU = hasExternalSignalingServer && webSocketClient != null && webSocketClient.hasMCU(); - for (String sessionId : newSessions) { getPeerConnectionWrapperForSessionIdAndType(sessionId, "video", hasMCU && sessionId.equals(webSocketClient.getSessionId())); }