Răsfoiți Sursa

Post MediaStreamEvent when the stream is actually added

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 <danxuliu@gmail.com>
Daniel Calviño Sánchez 2 ani în urmă
părinte
comite
30aafed0e8

+ 1 - 6
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