浏览代码

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 年之前
父节点
当前提交
30aafed0e8
共有 1 个文件被更改,包括 1 次插入6 次删除
  1. 1 6
      app/src/main/java/com/nextcloud/talk/webrtc/PeerConnectionWrapper.java

+ 1 - 6
app/src/main/java/com/nextcloud/talk/webrtc/PeerConnectionWrapper.java

@@ -100,7 +100,6 @@ public class PeerConnectionWrapper {
     private final MediaConstraints mediaConstraints;
     private final MediaConstraints mediaConstraints;
     private DataChannel dataChannel;
     private DataChannel dataChannel;
     private final MagicSdpObserver magicSdpObserver;
     private final MagicSdpObserver magicSdpObserver;
-    private MediaStream remoteStream;
 
 
     private final boolean hasInitiated;
     private final boolean hasInitiated;
 
 
@@ -416,10 +415,6 @@ public class PeerConnectionWrapper {
                 EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType.PEER_CONNECTED,
                 EventBus.getDefault().post(new PeerConnectionEvent(PeerConnectionEvent.PeerConnectionEventType.PEER_CONNECTED,
                                                                    sessionId, null, null, videoStreamType));
                                                                    sessionId, null, null, videoStreamType));
 
 
-                if (!isMCUPublisher) {
-                    EventBus.getDefault().post(new MediaStreamEvent(remoteStream, sessionId, videoStreamType));
-                }
-
                 if (hasInitiated) {
                 if (hasInitiated) {
                     sendInitialMediaStatus();
                     sendInitialMediaStatus();
                 }
                 }
@@ -477,7 +472,7 @@ public class PeerConnectionWrapper {
 
 
         @Override
         @Override
         public void onAddStream(MediaStream mediaStream) {
         public void onAddStream(MediaStream mediaStream) {
-            remoteStream = mediaStream;
+            EventBus.getDefault().post(new MediaStreamEvent(mediaStream, sessionId, videoStreamType));
         }
         }
 
 
         @Override
         @Override