diff --git a/app/src/main/java/com/nextcloud/talk/controllers/CallController.java b/app/src/main/java/com/nextcloud/talk/controllers/CallController.java index c32ec9220..468d258b6 100644 --- a/app/src/main/java/com/nextcloud/talk/controllers/CallController.java +++ b/app/src/main/java/com/nextcloud/talk/controllers/CallController.java @@ -1390,10 +1390,6 @@ public class CallController extends BaseController { @Override public void onNext(GenericOverall genericOverall) { - if (externalSignalingServer != null) { - webSocketClient.joinRoomWithRoomToken(""); - } - if (getActivity() != null) { getActivity().finish(); } @@ -1514,12 +1510,21 @@ public class CallController extends BaseController { } else { hasMCU = webSocketClient != null && webSocketClient.hasMCU(); + MediaConstraints mediaConstraintsToUse; + + if (hasMCU) { + mediaConstraintsToUse = sdpConstraintsForMCU; + } else { + mediaConstraintsToUse = sdpConstraints; + + } + if (sessionId.equals(callSession)) { magicPeerConnectionWrapper = new MagicPeerConnectionWrapper(peerConnectionFactory, - iceServers, sdpConstraintsForMCU, sessionId, callSession, localMediaStream, hasMCU); + iceServers, mediaConstraintsToUse, sessionId, callSession, localMediaStream, hasMCU); } else { magicPeerConnectionWrapper = new MagicPeerConnectionWrapper(peerConnectionFactory, - iceServers, sdpConstraintsForMCU, sessionId, callSession, null, hasMCU); + iceServers, mediaConstraintsToUse, sessionId, callSession, null, hasMCU); } magicPeerConnectionWrapperList.add(magicPeerConnectionWrapper); diff --git a/app/src/main/java/com/nextcloud/talk/webrtc/MagicPeerConnectionWrapper.java b/app/src/main/java/com/nextcloud/talk/webrtc/MagicPeerConnectionWrapper.java index efcfdeed8..d985da0fa 100644 --- a/app/src/main/java/com/nextcloud/talk/webrtc/MagicPeerConnectionWrapper.java +++ b/app/src/main/java/com/nextcloud/talk/webrtc/MagicPeerConnectionWrapper.java @@ -50,6 +50,8 @@ import java.nio.ByteBuffer; import java.util.ArrayList; import java.util.List; +import androidx.annotation.Nullable; + public class MagicPeerConnectionWrapper { private static String TAG = "MagicPeerConnectionWrapper"; List iceCandidates = new ArrayList<>(); @@ -72,7 +74,7 @@ public class MagicPeerConnectionWrapper { public MagicPeerConnectionWrapper(PeerConnectionFactory peerConnectionFactory, List iceServerList, MediaConstraints mediaConstraints, - String sessionId, String localSession, MediaStream mediaStream, + String sessionId, String localSession, @Nullable MediaStream mediaStream, boolean hasMCU) { this.localMediaStream = mediaStream; @@ -346,6 +348,7 @@ public class MagicPeerConnectionWrapper { EventBus.getDefault().post(new SessionDescriptionSendEvent(sessionDescriptionWithPreferredCodec, sessionId, sessionDescription.type.canonicalForm().toLowerCase(), null)); + if (peerConnection != null) { peerConnection.setLocalDescription(magicSdpObserver, sessionDescriptionWithPreferredCodec); }