mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-23 21:45:42 +03:00
New updates
This commit is contained in:
parent
6b46e078c1
commit
ade92c0344
5 changed files with 22 additions and 26 deletions
|
@ -1219,9 +1219,6 @@ public class CallController extends BaseController {
|
|||
case "signalingMessage":
|
||||
processMessage((NCSignalingMessage) webSocketClient.getJobWithId(Integer.valueOf(webSocketCommunicationEvent.getHashMap().get("jobId"))));
|
||||
break;
|
||||
case "peerConnectionReady":
|
||||
webSocketClient.requestOfferForSessionIdWithType(webSocketCommunicationEvent.getHashMap().get("sessionId"), "video");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1267,12 +1264,10 @@ public class CallController extends BaseController {
|
|||
|
||||
private void processMessage(NCSignalingMessage ncSignalingMessage) {
|
||||
if (ncSignalingMessage.getRoomType().equals("video")) {
|
||||
MagicPeerConnectionWrapper magicPeerConnectionWrapper = alwaysGetPeerConnectionWrapperForSessionId
|
||||
(ncSignalingMessage.getFrom(), false);
|
||||
MagicPeerConnectionWrapper magicPeerConnectionWrapper = alwaysGetPeerConnectionWrapperForSessionId(ncSignalingMessage.getFrom(), false);
|
||||
|
||||
String type = null;
|
||||
if (ncSignalingMessage.getPayload() != null && ncSignalingMessage.getPayload().getType() !=
|
||||
null) {
|
||||
if (ncSignalingMessage.getPayload() != null && ncSignalingMessage.getPayload().getType() != null) {
|
||||
type = ncSignalingMessage.getPayload().getType();
|
||||
} else if (ncSignalingMessage.getType() != null) {
|
||||
type = ncSignalingMessage.getType();
|
||||
|
@ -1490,7 +1485,11 @@ public class CallController extends BaseController {
|
|||
}
|
||||
|
||||
for (String sessionId : newSessions) {
|
||||
alwaysGetPeerConnectionWrapperForSessionId(sessionId, false);
|
||||
if (!hasMCU) {
|
||||
alwaysGetPeerConnectionWrapperForSessionId(sessionId, false);
|
||||
} else {
|
||||
webSocketClient.requestOfferForSessionIdWithType(sessionId, "video");
|
||||
}
|
||||
}
|
||||
|
||||
for (String sessionId : oldSesssions) {
|
||||
|
@ -1542,19 +1541,15 @@ public class CallController extends BaseController {
|
|||
} else {
|
||||
hasMCU = webSocketClient != null && webSocketClient.hasMCU();
|
||||
|
||||
if (sessionId == null) {
|
||||
Log.d("MARIO", "ISNULL");
|
||||
}
|
||||
|
||||
if (hasMCU && publisher) {
|
||||
magicPeerConnectionWrapper = new MagicPeerConnectionWrapper(peerConnectionFactory,
|
||||
iceServers, sdpConstraintsForMCU, sessionId, callSession, localMediaStream, true, true);
|
||||
iceServers, sdpConstraintsForMCU, sessionId, callSession, localMediaStream, true);
|
||||
} else if (hasMCU) {
|
||||
magicPeerConnectionWrapper = new MagicPeerConnectionWrapper(peerConnectionFactory,
|
||||
iceServers, sdpConstraints, sessionId, callSession, null, false, true);
|
||||
iceServers, sdpConstraints, sessionId, callSession, null, false);
|
||||
} else {
|
||||
magicPeerConnectionWrapper = new MagicPeerConnectionWrapper(peerConnectionFactory,
|
||||
iceServers, sdpConstraints, sessionId, callSession, localMediaStream, false, false);
|
||||
iceServers, sdpConstraints, sessionId, callSession, localMediaStream, false);
|
||||
}
|
||||
|
||||
magicPeerConnectionWrapperList.add(magicPeerConnectionWrapper);
|
||||
|
|
|
@ -42,4 +42,7 @@ public class NCMessagePayload {
|
|||
|
||||
@JsonField(name = "candidate")
|
||||
NCIceCandidate iceCandidate;
|
||||
|
||||
@JsonField(name = "name")
|
||||
String name;
|
||||
}
|
||||
|
|
|
@ -43,5 +43,6 @@ public class NCSignalingMessage {
|
|||
String roomType;
|
||||
@JsonField(name = "sid")
|
||||
String sid;
|
||||
|
||||
@JsonField(name = "prefix")
|
||||
String prefix;
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ public class MagicPeerConnectionWrapper {
|
|||
List<PeerConnection.IceServer> iceServerList,
|
||||
MediaConstraints mediaConstraints,
|
||||
String sessionId, String localSession, @Nullable MediaStream mediaStream,
|
||||
boolean isMCUPublisher, boolean hasMCU) {
|
||||
boolean isMCUPublisher) {
|
||||
|
||||
this.localMediaStream = mediaStream;
|
||||
|
||||
|
@ -95,18 +95,13 @@ public class MagicPeerConnectionWrapper {
|
|||
peerConnection.addStream(localMediaStream);
|
||||
}
|
||||
|
||||
if (hasMCU || hasInitiated) {
|
||||
if (isMCUPublisher || hasInitiated) {
|
||||
DataChannel.Init init = new DataChannel.Init();
|
||||
init.negotiated = false;
|
||||
magicDataChannel = peerConnection.createDataChannel("status", init);
|
||||
magicDataChannel.registerObserver(new MagicDataChannelObserver());
|
||||
if (isMCUPublisher) {
|
||||
peerConnection.createOffer(magicSdpObserver, mediaConstraints);
|
||||
} else if (hasMCU) {
|
||||
HashMap<String, String> peerConnectionReadyMap = new HashMap<>();
|
||||
peerConnectionReadyMap.put("sessionId", sessionId);
|
||||
EventBus.getDefault().post(new WebSocketCommunicationEvent("peerConnectionReady", peerConnectionReadyMap));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -164,9 +164,11 @@ public class MagicWebSocketInstance extends WebSocketListener {
|
|||
break;
|
||||
case "message":
|
||||
CallOverallWebSocketMessage callOverallWebSocketMessage = LoganSquare.parse(text, CallOverallWebSocketMessage.class);
|
||||
HashMap<String, String> messageHashMap = new HashMap<>();
|
||||
messageHashMap.put("jobId", Integer.toString(magicMap.add(callOverallWebSocketMessage.getCallWebSocketMessage().getNcSignalingMessage())));
|
||||
eventBus.post(new WebSocketCommunicationEvent("signalingMessage", messageHashMap));
|
||||
if (callOverallWebSocketMessage.getCallWebSocketMessage().getNcSignalingMessage().getPrefix() == null) {
|
||||
HashMap<String, String> messageHashMap = new HashMap<>();
|
||||
messageHashMap.put("jobId", Integer.toString(magicMap.add(callOverallWebSocketMessage.getCallWebSocketMessage().getNcSignalingMessage())));
|
||||
eventBus.post(new WebSocketCommunicationEvent("signalingMessage", messageHashMap));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue