Move "hasMCU" update to the top of the method

"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 <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2021-04-09 13:55:40 +02:00 committed by Marcel Hibbe
parent 8adfb7c2cd
commit 004c7b296a
No known key found for this signature in database
GPG key ID: C793F8B59F43CE7B

View file

@ -1655,6 +1655,8 @@ public class CallController extends BaseController {
List<String> newSessions = new ArrayList<>();
Set<String> oldSesssions = new HashSet<>();
hasMCU = hasExternalSignalingServer && webSocketClient != null && webSocketClient.hasMCU();
for (HashMap<String, Object> 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()));
}