mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-27 17:08:34 +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":
|
case "signalingMessage":
|
||||||
processMessage((NCSignalingMessage) webSocketClient.getJobWithId(Integer.valueOf(webSocketCommunicationEvent.getHashMap().get("jobId"))));
|
processMessage((NCSignalingMessage) webSocketClient.getJobWithId(Integer.valueOf(webSocketCommunicationEvent.getHashMap().get("jobId"))));
|
||||||
break;
|
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) {
|
private void processMessage(NCSignalingMessage ncSignalingMessage) {
|
||||||
if (ncSignalingMessage.getRoomType().equals("video")) {
|
if (ncSignalingMessage.getRoomType().equals("video")) {
|
||||||
MagicPeerConnectionWrapper magicPeerConnectionWrapper = alwaysGetPeerConnectionWrapperForSessionId
|
MagicPeerConnectionWrapper magicPeerConnectionWrapper = alwaysGetPeerConnectionWrapperForSessionId(ncSignalingMessage.getFrom(), false);
|
||||||
(ncSignalingMessage.getFrom(), false);
|
|
||||||
|
|
||||||
String type = null;
|
String type = null;
|
||||||
if (ncSignalingMessage.getPayload() != null && ncSignalingMessage.getPayload().getType() !=
|
if (ncSignalingMessage.getPayload() != null && ncSignalingMessage.getPayload().getType() != null) {
|
||||||
null) {
|
|
||||||
type = ncSignalingMessage.getPayload().getType();
|
type = ncSignalingMessage.getPayload().getType();
|
||||||
} else if (ncSignalingMessage.getType() != null) {
|
} else if (ncSignalingMessage.getType() != null) {
|
||||||
type = ncSignalingMessage.getType();
|
type = ncSignalingMessage.getType();
|
||||||
|
@ -1490,7 +1485,11 @@ public class CallController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String sessionId : newSessions) {
|
for (String sessionId : newSessions) {
|
||||||
|
if (!hasMCU) {
|
||||||
alwaysGetPeerConnectionWrapperForSessionId(sessionId, false);
|
alwaysGetPeerConnectionWrapperForSessionId(sessionId, false);
|
||||||
|
} else {
|
||||||
|
webSocketClient.requestOfferForSessionIdWithType(sessionId, "video");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (String sessionId : oldSesssions) {
|
for (String sessionId : oldSesssions) {
|
||||||
|
@ -1542,19 +1541,15 @@ public class CallController extends BaseController {
|
||||||
} else {
|
} else {
|
||||||
hasMCU = webSocketClient != null && webSocketClient.hasMCU();
|
hasMCU = webSocketClient != null && webSocketClient.hasMCU();
|
||||||
|
|
||||||
if (sessionId == null) {
|
|
||||||
Log.d("MARIO", "ISNULL");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasMCU && publisher) {
|
if (hasMCU && publisher) {
|
||||||
magicPeerConnectionWrapper = new MagicPeerConnectionWrapper(peerConnectionFactory,
|
magicPeerConnectionWrapper = new MagicPeerConnectionWrapper(peerConnectionFactory,
|
||||||
iceServers, sdpConstraintsForMCU, sessionId, callSession, localMediaStream, true, true);
|
iceServers, sdpConstraintsForMCU, sessionId, callSession, localMediaStream, true);
|
||||||
} else if (hasMCU) {
|
} else if (hasMCU) {
|
||||||
magicPeerConnectionWrapper = new MagicPeerConnectionWrapper(peerConnectionFactory,
|
magicPeerConnectionWrapper = new MagicPeerConnectionWrapper(peerConnectionFactory,
|
||||||
iceServers, sdpConstraints, sessionId, callSession, null, false, true);
|
iceServers, sdpConstraints, sessionId, callSession, null, false);
|
||||||
} else {
|
} else {
|
||||||
magicPeerConnectionWrapper = new MagicPeerConnectionWrapper(peerConnectionFactory,
|
magicPeerConnectionWrapper = new MagicPeerConnectionWrapper(peerConnectionFactory,
|
||||||
iceServers, sdpConstraints, sessionId, callSession, localMediaStream, false, false);
|
iceServers, sdpConstraints, sessionId, callSession, localMediaStream, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
magicPeerConnectionWrapperList.add(magicPeerConnectionWrapper);
|
magicPeerConnectionWrapperList.add(magicPeerConnectionWrapper);
|
||||||
|
|
|
@ -42,4 +42,7 @@ public class NCMessagePayload {
|
||||||
|
|
||||||
@JsonField(name = "candidate")
|
@JsonField(name = "candidate")
|
||||||
NCIceCandidate iceCandidate;
|
NCIceCandidate iceCandidate;
|
||||||
|
|
||||||
|
@JsonField(name = "name")
|
||||||
|
String name;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,5 +43,6 @@ public class NCSignalingMessage {
|
||||||
String roomType;
|
String roomType;
|
||||||
@JsonField(name = "sid")
|
@JsonField(name = "sid")
|
||||||
String sid;
|
String sid;
|
||||||
|
@JsonField(name = "prefix")
|
||||||
|
String prefix;
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class MagicPeerConnectionWrapper {
|
||||||
List<PeerConnection.IceServer> iceServerList,
|
List<PeerConnection.IceServer> iceServerList,
|
||||||
MediaConstraints mediaConstraints,
|
MediaConstraints mediaConstraints,
|
||||||
String sessionId, String localSession, @Nullable MediaStream mediaStream,
|
String sessionId, String localSession, @Nullable MediaStream mediaStream,
|
||||||
boolean isMCUPublisher, boolean hasMCU) {
|
boolean isMCUPublisher) {
|
||||||
|
|
||||||
this.localMediaStream = mediaStream;
|
this.localMediaStream = mediaStream;
|
||||||
|
|
||||||
|
@ -95,18 +95,13 @@ public class MagicPeerConnectionWrapper {
|
||||||
peerConnection.addStream(localMediaStream);
|
peerConnection.addStream(localMediaStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasMCU || hasInitiated) {
|
if (isMCUPublisher || hasInitiated) {
|
||||||
DataChannel.Init init = new DataChannel.Init();
|
DataChannel.Init init = new DataChannel.Init();
|
||||||
init.negotiated = false;
|
init.negotiated = false;
|
||||||
magicDataChannel = peerConnection.createDataChannel("status", init);
|
magicDataChannel = peerConnection.createDataChannel("status", init);
|
||||||
magicDataChannel.registerObserver(new MagicDataChannelObserver());
|
magicDataChannel.registerObserver(new MagicDataChannelObserver());
|
||||||
if (isMCUPublisher) {
|
if (isMCUPublisher) {
|
||||||
peerConnection.createOffer(magicSdpObserver, mediaConstraints);
|
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;
|
break;
|
||||||
case "message":
|
case "message":
|
||||||
CallOverallWebSocketMessage callOverallWebSocketMessage = LoganSquare.parse(text, CallOverallWebSocketMessage.class);
|
CallOverallWebSocketMessage callOverallWebSocketMessage = LoganSquare.parse(text, CallOverallWebSocketMessage.class);
|
||||||
|
if (callOverallWebSocketMessage.getCallWebSocketMessage().getNcSignalingMessage().getPrefix() == null) {
|
||||||
HashMap<String, String> messageHashMap = new HashMap<>();
|
HashMap<String, String> messageHashMap = new HashMap<>();
|
||||||
messageHashMap.put("jobId", Integer.toString(magicMap.add(callOverallWebSocketMessage.getCallWebSocketMessage().getNcSignalingMessage())));
|
messageHashMap.put("jobId", Integer.toString(magicMap.add(callOverallWebSocketMessage.getCallWebSocketMessage().getNcSignalingMessage())));
|
||||||
eventBus.post(new WebSocketCommunicationEvent("signalingMessage", messageHashMap));
|
eventBus.post(new WebSocketCommunicationEvent("signalingMessage", messageHashMap));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue