From a922b95d9551c32c3b5fe084b99b20731de0af32 Mon Sep 17 00:00:00 2001 From: pabloFuente Date: Thu, 30 Apr 2020 14:01:55 +0200 Subject: [PATCH] openvidu-server: add IceCandidates only after webEndpoint is available --- .../server/kurento/endpoint/MediaEndpoint.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/openvidu-server/src/main/java/io/openvidu/server/kurento/endpoint/MediaEndpoint.java b/openvidu-server/src/main/java/io/openvidu/server/kurento/endpoint/MediaEndpoint.java index 70a5c70e..919237c2 100644 --- a/openvidu-server/src/main/java/io/openvidu/server/kurento/endpoint/MediaEndpoint.java +++ b/openvidu-server/src/main/java/io/openvidu/server/kurento/endpoint/MediaEndpoint.java @@ -214,10 +214,10 @@ public abstract class MediaEndpoint { internalEndpointInitialization(endpointLatch); } else { endpointLatch.countDown(); - } - if (this.isWeb()) { - while (!candidates.isEmpty()) { - internalAddIceCandidate(candidates.removeFirst()); + if (this.isWeb()) { + while (!candidates.isEmpty()) { + internalAddIceCandidate(candidates.removeFirst()); + } } } return old; @@ -291,6 +291,11 @@ public abstract class MediaEndpoint { } endpointLatch.countDown(); + + while (!candidates.isEmpty()) { + internalAddIceCandidate(candidates.removeFirst()); + } + log.trace("EP {}: Created a new WebRtcEndpoint", endpointName); endpointSubscription = registerElemErrListener(webEndpoint);