Fix a few bugs

This commit is contained in:
Mario Danic 2018-10-15 21:57:30 +02:00
parent 8c0050ee3b
commit 54144b1c8c
2 changed files with 15 additions and 7 deletions

View file

@ -1390,10 +1390,6 @@ public class CallController extends BaseController {
@Override @Override
public void onNext(GenericOverall genericOverall) { public void onNext(GenericOverall genericOverall) {
if (externalSignalingServer != null) {
webSocketClient.joinRoomWithRoomToken("");
}
if (getActivity() != null) { if (getActivity() != null) {
getActivity().finish(); getActivity().finish();
} }
@ -1514,12 +1510,21 @@ public class CallController extends BaseController {
} else { } else {
hasMCU = webSocketClient != null && webSocketClient.hasMCU(); hasMCU = webSocketClient != null && webSocketClient.hasMCU();
MediaConstraints mediaConstraintsToUse;
if (hasMCU) {
mediaConstraintsToUse = sdpConstraintsForMCU;
} else {
mediaConstraintsToUse = sdpConstraints;
}
if (sessionId.equals(callSession)) { if (sessionId.equals(callSession)) {
magicPeerConnectionWrapper = new MagicPeerConnectionWrapper(peerConnectionFactory, magicPeerConnectionWrapper = new MagicPeerConnectionWrapper(peerConnectionFactory,
iceServers, sdpConstraintsForMCU, sessionId, callSession, localMediaStream, hasMCU); iceServers, mediaConstraintsToUse, sessionId, callSession, localMediaStream, hasMCU);
} else { } else {
magicPeerConnectionWrapper = new MagicPeerConnectionWrapper(peerConnectionFactory, magicPeerConnectionWrapper = new MagicPeerConnectionWrapper(peerConnectionFactory,
iceServers, sdpConstraintsForMCU, sessionId, callSession, null, hasMCU); iceServers, mediaConstraintsToUse, sessionId, callSession, null, hasMCU);
} }
magicPeerConnectionWrapperList.add(magicPeerConnectionWrapper); magicPeerConnectionWrapperList.add(magicPeerConnectionWrapper);

View file

@ -50,6 +50,8 @@ import java.nio.ByteBuffer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import androidx.annotation.Nullable;
public class MagicPeerConnectionWrapper { public class MagicPeerConnectionWrapper {
private static String TAG = "MagicPeerConnectionWrapper"; private static String TAG = "MagicPeerConnectionWrapper";
List<IceCandidate> iceCandidates = new ArrayList<>(); List<IceCandidate> iceCandidates = new ArrayList<>();
@ -72,7 +74,7 @@ public class MagicPeerConnectionWrapper {
public MagicPeerConnectionWrapper(PeerConnectionFactory peerConnectionFactory, public MagicPeerConnectionWrapper(PeerConnectionFactory peerConnectionFactory,
List<PeerConnection.IceServer> iceServerList, List<PeerConnection.IceServer> iceServerList,
MediaConstraints mediaConstraints, MediaConstraints mediaConstraints,
String sessionId, String localSession, MediaStream mediaStream, String sessionId, String localSession, @Nullable MediaStream mediaStream,
boolean hasMCU) { boolean hasMCU) {
this.localMediaStream = mediaStream; this.localMediaStream = mediaStream;
@ -346,6 +348,7 @@ public class MagicPeerConnectionWrapper {
EventBus.getDefault().post(new SessionDescriptionSendEvent(sessionDescriptionWithPreferredCodec, sessionId, EventBus.getDefault().post(new SessionDescriptionSendEvent(sessionDescriptionWithPreferredCodec, sessionId,
sessionDescription.type.canonicalForm().toLowerCase(), null)); sessionDescription.type.canonicalForm().toLowerCase(), null));
if (peerConnection != null) { if (peerConnection != null) {
peerConnection.setLocalDescription(magicSdpObserver, sessionDescriptionWithPreferredCodec); peerConnection.setLocalDescription(magicSdpObserver, sessionDescriptionWithPreferredCodec);
} }