This is an automated email from the ASF dual-hosted git repository. sebawagner pushed a commit to branch feature/OPENMEETINGS-2580-re-apply-ice-before-sending-ws-candidates in repository https://gitbox.apache.org/repos/asf/openmeetings.git
commit e3ed441ad8707b8094ae9dcb00cc1d390a219b3a Author: Sebastian Wagner <[email protected]> AuthorDate: Thu Feb 25 09:45:03 2021 +1300 OPENMEETINGS-2580 Move adding iceCandidates before sending ws notification. --- .../apache/openmeetings/core/remote/KStream.java | 23 ++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/KStream.java b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/KStream.java index a2f786f..bfe7175 100644 --- a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/KStream.java +++ b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/KStream.java @@ -151,12 +151,6 @@ public class KStream extends AbstractStream implements ISipCallbacks { addSipProcessor(1); } else { outgoingMedia = createEndpoint(sd.getSid(), sd.getUid(), true); - if (!candidatesQueue.isEmpty()) { - log.trace("addIceCandidate iceCandidate reply from not ready, uid: {}", sd.getUid()); - candidatesQueue.stream() - .forEach(candidate -> ((WebRtcEndpoint)outgoingMedia).addIceCandidate(candidate)); - candidatesQueue.clear(); - } internalStartBroadcast(sd, sdpOffer); notifyOnNewStream(sd); } @@ -243,7 +237,7 @@ public class KStream extends AbstractStream implements ISipCallbacks { public void addListener(String sid, String uid, String sdpOffer) { final boolean self = uid.equals(this.uid); - log.info("USER {}: have started, sid {}, uid {} in kRoom {}", sid, uid, self ? "broadcasting" : "receiving", getRoomId()); + log.info("USER: have started, sid {}, uid {} in kRoom {}", sid, uid, self ? "broadcasting" : "receiving", getRoomId()); log.trace("USER {}: SdpOffer is {}", uid, sdpOffer); if (!self && outgoingMedia == null) { log.warn("Trying to add listener too early, sid {}, uid {}", sid, uid); @@ -254,7 +248,7 @@ public class KStream extends AbstractStream implements ISipCallbacks { final String sdpAnswer = endpoint.processOffer(sdpOffer); if (endpoint instanceof WebRtcEndpoint) { - log.debug("gather candidates"); + log.debug("gather candidates, sid {}, uid {}", sid, uid); ((WebRtcEndpoint)endpoint).gatherCandidates(); // this one might throw Exception } log.trace("USER {}: SdpAnswer is {}", this.uid, sdpAnswer); @@ -315,6 +309,15 @@ public class KStream extends AbstractStream implements ISipCallbacks { WebRtcEndpoint endpoint = createWebRtcEndpoint(pipeline, recv); setTags(endpoint, uid); + if (recv) { + if (!candidatesQueue.isEmpty()) { + log.trace("addIceCandidate iceCandidate reply from not ready, uid: {}", uid); + candidatesQueue.stream() + .forEach(candidate -> endpoint.addIceCandidate(candidate)); + candidatesQueue.clear(); + } + } + endpoint.addIceCandidateFoundListener(evt -> kHandler.sendClient(sid , newKurentoMsg() .put("id", "iceCandidate") @@ -516,7 +519,7 @@ public class KStream extends AbstractStream implements ISipCallbacks { if (this.uid.equals(uid)) { if (!(outgoingMedia instanceof WebRtcEndpoint)) { if (!sipClient) { - log.info("addIceCandidate iceCandidate while not ready yet, uid: {}", uid); + log.info("addIceCandidate iceCandidate while not ready yet, uid: {}, candidate: {}", uid, candidate.getCandidate()); candidatesQueue.add(candidate); } return; @@ -528,7 +531,7 @@ public class KStream extends AbstractStream implements ISipCallbacks { if (endpoint != null) { endpoint.addIceCandidate(candidate); } else { - log.warn("addIceCandidate iceCandidate could not find endpoint, uid: {}", uid); + log.warn("addIceCandidate iceCandidate could not find endpoint, uid: {}, candidate: {}", uid, candidate.getCandidate()); } } }
