You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2021/02/24 10:54:50 UTC
[openmeetings] branch master updated: OPENMEETINGS-2580 Enable
additional logs for making failed attempts to add ice candidate visible
(#131)
This is an automated email from the ASF dual-hosted git repository.
solomax pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openmeetings.git
The following commit(s) were added to refs/heads/master by this push:
new 629974c OPENMEETINGS-2580 Enable additional logs for making failed attempts to add ice candidate visible (#131)
629974c is described below
commit 629974c5bd343b47c8475db3c5cf4692d087461a
Author: Sebastian Wagner <se...@apache.org>
AuthorDate: Wed Feb 24 23:54:43 2021 +1300
OPENMEETINGS-2580 Enable additional logs for making failed attempts to add ice candidate visible (#131)
* OPENMEETINGS-2580 Enable additional logs for making failed attempts to add ice candidate visible.
* OPENMEETINGS-2580 Queue missing early iceCandidates and re-apply once connection established with WebRtcEndpoint.
* [OPENMEETINGS-2580] some improvements
Co-authored-by: Maxim Solodovnik <so...@gmail.com>
---
.../org/apache/openmeetings/core/remote/KStream.java | 20 +++++++++++++++++---
.../core/remote/StreamProcessorActions.java | 8 +++++---
2 files changed, 22 insertions(+), 6 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 47d8201..a2f786f 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
@@ -36,9 +36,10 @@ import java.util.Date;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
+import java.util.Queue;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.TimeUnit;
import java.util.function.Consumer;
@@ -82,9 +83,10 @@ public class KStream extends AbstractStream implements ISipCallbacks {
private MediaPipeline pipeline;
private RecorderEndpoint recorder;
private BaseRtpEndpoint outgoingMedia = null;
+ private Queue<IceCandidate> candidatesQueue = new ConcurrentLinkedQueue<>();
private RtpEndpoint rtpEndpoint;
private Optional<SipStackProcessor> sipProcessor = Optional.empty();
- private final ConcurrentMap<String, WebRtcEndpoint> listeners = new ConcurrentHashMap<>();
+ private final Map<String, WebRtcEndpoint> listeners = new ConcurrentHashMap<>();
private Optional<CompletableFuture<Object>> flowoutFuture = Optional.empty();
private ListenerSubscription flowoutSubscription;
private Long chunkId;
@@ -149,6 +151,12 @@ 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);
}
@@ -504,9 +512,13 @@ public class KStream extends AbstractStream implements ISipCallbacks {
sipProcessor = Optional.empty();
}
- public void addCandidate(IceCandidate candidate, String uid) {
+ public void addIceCandidate(IceCandidate candidate, String uid) {
if (this.uid.equals(uid)) {
if (!(outgoingMedia instanceof WebRtcEndpoint)) {
+ if (!sipClient) {
+ log.info("addIceCandidate iceCandidate while not ready yet, uid: {}", uid);
+ candidatesQueue.add(candidate);
+ }
return;
}
((WebRtcEndpoint)outgoingMedia).addIceCandidate(candidate);
@@ -515,6 +527,8 @@ public class KStream extends AbstractStream implements ISipCallbacks {
log.debug("Add candidate for {}, listener found ? {}", uid, endpoint != null);
if (endpoint != null) {
endpoint.addIceCandidate(candidate);
+ } else {
+ log.warn("addIceCandidate iceCandidate could not find endpoint, uid: {}", uid);
}
}
}
diff --git a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/StreamProcessorActions.java b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/StreamProcessorActions.java
index 6580918..8608485 100644
--- a/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/StreamProcessorActions.java
+++ b/openmeetings-core/src/main/java/org/apache/openmeetings/core/remote/StreamProcessorActions.java
@@ -54,17 +54,19 @@ public class StreamProcessorActions {
protected void addIceCandidate(JSONObject msg) {
final String uid = msg.optString("uid");
KStream sender;
+ JSONObject candidate = msg.getJSONObject(PARAM_CANDIDATE);
+ String candStr = candidate.getString(PARAM_CANDIDATE);
sender = streamProcessor.getByUid(uid);
if (sender != null) {
- JSONObject candidate = msg.getJSONObject(PARAM_CANDIDATE);
- String candStr = candidate.getString(PARAM_CANDIDATE);
if (!Strings.isEmpty(candStr)) {
IceCandidate cand = new IceCandidate(
candStr
, candidate.getString("sdpMid")
, candidate.getInt("sdpMLineIndex"));
- sender.addCandidate(cand, msg.getString("luid"));
+ sender.addIceCandidate(cand, msg.getString("luid"));
}
+ } else {
+ log.warn("addIceCandidate sender is empty, uid: {}, candStr: {} ", uid, candStr);
}
}