From 30aafed0e8777096f8f03393a7cce598445c1af9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Tue, 22 Nov 2022 01:24:40 +0100 Subject: [PATCH] Post MediaStreamEvent when the stream is actually added MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The MediaStreamEvent was posted when the connection with the remote peer was established. However, the MediaStream is added earlier (as soon as the remote description is received), so the event is moved to better reflect that. Note that checking if the connection is an MCU publisher is no longer needed, as publisher connections are sender only and therefore no remote stream is added for publisher connections. In any case, note that the stream will not start until the connection is established, and a progress bar will be anyway shown on the ParticipantDisplayItem until it is connected. Signed-off-by: Daniel Calviño Sánchez --- .../com/nextcloud/talk/webrtc/PeerConnectionWrapper.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/webrtc/PeerConnectionWrapper.java b/app/src/main/java/com/nextcloud/talk/webrtc/PeerConnectionWrapper.java index c5b2f66b2..5ea4806c7 100644 --- a/app/src/main/java/com/nextcloud/talk/webrtc/PeerConnectionWrapper.java +++ b/app/src/main/java/com/nextcloud/talk/webrtc/PeerConnectionWrapper.java @@ -100,7 +100,6 @@ public class PeerConnectionWrapper { private final MediaConstraints mediaConstraints; private DataChannel dataChannel; private final MagicSdpObserver magicSdpObserver; - private MediaStream remoteStream; private final boolean hasInitiated; @@ -416,10 +415,6 @@ public class PeerConnectionWrapper { EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType.PEER_CONNECTED, sessionId, null, null, videoStreamType)); - if (!isMCUPublisher) { - EventBus.getDefault().post(new MediaStreamEvent(remoteStream, sessionId, videoStreamType)); - } - if (hasInitiated) { sendInitialMediaStatus(); } @@ -477,7 +472,7 @@ public class PeerConnectionWrapper { @Override public void onAddStream(MediaStream mediaStream) { - remoteStream = mediaStream; + EventBus.getDefault().post(new MediaStreamEvent(mediaStream, sessionId, videoStreamType)); } @Override