Fix ParticipantDisplayItems not updated on events

The ParticipantDisplayItems were associated to both the session ID and
the video stream type ("video" or "screen"), but the code that gets them
was not updated to include the video stream type in the key.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2022-11-15 21:49:09 +01:00 committed by Andy Scherzinger
parent ed54b9f03a
commit 45224741fd
No known key found for this signature in database
GPG Key ID: 6CADC7E3523C308B

View File

@ -2164,21 +2164,22 @@ public class CallActivity extends CallBaseActivity {
@Subscribe(threadMode = ThreadMode.MAIN) @Subscribe(threadMode = ThreadMode.MAIN)
public void onMessageEvent(PeerConnectionEvent peerConnectionEvent) { public void onMessageEvent(PeerConnectionEvent peerConnectionEvent) {
String sessionId = peerConnectionEvent.getSessionId(); String sessionId = peerConnectionEvent.getSessionId();
String participantDisplayItemId = sessionId + "-" + peerConnectionEvent.getVideoStreamType();
if (peerConnectionEvent.getPeerConnectionEventType() == if (peerConnectionEvent.getPeerConnectionEventType() ==
PeerConnectionEvent.PeerConnectionEventType.PEER_CONNECTED) { PeerConnectionEvent.PeerConnectionEventType.PEER_CONNECTED) {
if (webSocketClient != null && webSocketClient.getSessionId() != null && webSocketClient.getSessionId().equals(sessionId)) { if (webSocketClient != null && webSocketClient.getSessionId() != null && webSocketClient.getSessionId().equals(sessionId)) {
updateSelfVideoViewConnected(true); updateSelfVideoViewConnected(true);
} else if (participantDisplayItems.get(sessionId) != null) { } else if (participantDisplayItems.get(participantDisplayItemId) != null) {
participantDisplayItems.get(sessionId).setConnected(true); participantDisplayItems.get(participantDisplayItemId).setConnected(true);
participantsAdapter.notifyDataSetChanged(); participantsAdapter.notifyDataSetChanged();
} }
} else if (peerConnectionEvent.getPeerConnectionEventType() == } else if (peerConnectionEvent.getPeerConnectionEventType() ==
PeerConnectionEvent.PeerConnectionEventType.PEER_DISCONNECTED) { PeerConnectionEvent.PeerConnectionEventType.PEER_DISCONNECTED) {
if (webSocketClient != null && webSocketClient.getSessionId() != null && webSocketClient.getSessionId().equals(sessionId)) { if (webSocketClient != null && webSocketClient.getSessionId() != null && webSocketClient.getSessionId().equals(sessionId)) {
updateSelfVideoViewConnected(false); updateSelfVideoViewConnected(false);
} else if (participantDisplayItems.get(sessionId) != null) { } else if (participantDisplayItems.get(participantDisplayItemId) != null) {
participantDisplayItems.get(sessionId).setConnected(false); participantDisplayItems.get(participantDisplayItemId).setConnected(false);
participantsAdapter.notifyDataSetChanged(); participantsAdapter.notifyDataSetChanged();
} }
} else if (peerConnectionEvent.getPeerConnectionEventType() == } else if (peerConnectionEvent.getPeerConnectionEventType() ==
@ -2200,20 +2201,20 @@ public class CallActivity extends CallBaseActivity {
} }
} else if (peerConnectionEvent.getPeerConnectionEventType() == } else if (peerConnectionEvent.getPeerConnectionEventType() ==
PeerConnectionEvent.PeerConnectionEventType.NICK_CHANGE) { PeerConnectionEvent.PeerConnectionEventType.NICK_CHANGE) {
if (participantDisplayItems.get(sessionId) != null) { if (participantDisplayItems.get(participantDisplayItemId) != null) {
participantDisplayItems.get(sessionId).setNick(peerConnectionEvent.getNick()); participantDisplayItems.get(participantDisplayItemId).setNick(peerConnectionEvent.getNick());
participantsAdapter.notifyDataSetChanged(); participantsAdapter.notifyDataSetChanged();
} }
} else if (peerConnectionEvent.getPeerConnectionEventType() == } else if (peerConnectionEvent.getPeerConnectionEventType() ==
PeerConnectionEvent.PeerConnectionEventType.VIDEO_CHANGE && !isVoiceOnlyCall) { PeerConnectionEvent.PeerConnectionEventType.VIDEO_CHANGE && !isVoiceOnlyCall) {
if (participantDisplayItems.get(sessionId) != null) { if (participantDisplayItems.get(participantDisplayItemId) != null) {
participantDisplayItems.get(sessionId).setStreamEnabled(peerConnectionEvent.getChangeValue()); participantDisplayItems.get(participantDisplayItemId).setStreamEnabled(peerConnectionEvent.getChangeValue());
participantsAdapter.notifyDataSetChanged(); participantsAdapter.notifyDataSetChanged();
} }
} else if (peerConnectionEvent.getPeerConnectionEventType() == } else if (peerConnectionEvent.getPeerConnectionEventType() ==
PeerConnectionEvent.PeerConnectionEventType.AUDIO_CHANGE) { PeerConnectionEvent.PeerConnectionEventType.AUDIO_CHANGE) {
if (participantDisplayItems.get(sessionId) != null) { if (participantDisplayItems.get(participantDisplayItemId) != null) {
participantDisplayItems.get(sessionId).setAudioEnabled(peerConnectionEvent.getChangeValue()); participantDisplayItems.get(participantDisplayItemId).setAudioEnabled(peerConnectionEvent.getChangeValue());
participantsAdapter.notifyDataSetChanged(); participantsAdapter.notifyDataSetChanged();
} }
} else if (peerConnectionEvent.getPeerConnectionEventType() == } else if (peerConnectionEvent.getPeerConnectionEventType() ==