Merge pull request #2484 from nextcloud/fix-computing-new-sessions-in-call

Fix computing new sessions in call
This commit is contained in:
Tim Krüger 2022-10-13 18:08:57 +02:00 committed by GitHub
commit a17acc779c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1851,17 +1851,14 @@ public class CallActivity extends CallBaseActivity {
for (HashMap<String, Object> participant : users) {
long inCallFlag = (long) participant.get("inCall");
if (!participant.get("sessionId").equals(currentSessionId)) {
boolean isNewSession;
Log.d(TAG, " inCallFlag of participant "
+ participant.get("sessionId").toString().substring(0, 4)
+ " : "
+ inCallFlag);
isNewSession = inCallFlag != 0;
if (isNewSession) {
boolean isInCall = inCallFlag != 0;
if (isInCall) {
newSessions.add(participant.get("sessionId").toString());
} else {
oldSessions.add(participant.get("sessionId").toString());
}
// The property is "userId" when not using the external signaling server and "userid" when using it.
@ -1888,7 +1885,8 @@ public class CallActivity extends CallBaseActivity {
}
// Calculate sessions that left the call
oldSessions.removeAll(newSessions);
List<String> disconnectedSessions = new ArrayList<>(oldSessions);
disconnectedSessions.removeAll(newSessions);
// Calculate sessions that join the call
newSessions.removeAll(oldSessions);
@ -1926,7 +1924,7 @@ public class CallActivity extends CallBaseActivity {
setCallState(CallStatus.IN_CONVERSATION);
}
for (String sessionId : oldSessions) {
for (String sessionId : disconnectedSessions) {
Log.d(TAG, " oldSession that will be removed is: " + sessionId);
endPeerConnection(sessionId, false);
}