openvidu-server: generatedCandidates to gatheredCandidates

pull/469/head
pabloFuente 2020-05-14 14:37:49 +02:00
parent d58201d550
commit 8863a6e2b1
2 changed files with 12 additions and 10 deletions

View File

@ -525,6 +525,7 @@ export class OpenVidu {
localCandidate: publisherExtended.localCandidate, localCandidate: publisherExtended.localCandidate,
remoteCandidate: publisherExtended.remoteCandidate, remoteCandidate: publisherExtended.remoteCandidate,
receivedCandidates: publisherExtended.receivedCandidates, receivedCandidates: publisherExtended.receivedCandidates,
gatheredCandidates: publisherExtended.gatheredCandidates,
webrtcEndpointName: publisherExtended.webrtcEndpointName, webrtcEndpointName: publisherExtended.webrtcEndpointName,
localSdp: publisherExtended.localSdp, localSdp: publisherExtended.localSdp,
remoteSdp: publisherExtended.remoteSdp remoteSdp: publisherExtended.remoteSdp
@ -551,6 +552,7 @@ export class OpenVidu {
localCandidate: subscriberExtended.localCandidate, localCandidate: subscriberExtended.localCandidate,
remoteCandidate: subscriberExtended.remoteCandidate, remoteCandidate: subscriberExtended.remoteCandidate,
receivedCandidates: subscriberExtended.receivedCandidates, receivedCandidates: subscriberExtended.receivedCandidates,
gatheredCandidates: subscriberExtended.gatheredCandidates,
webrtcEndpointName: subscriberExtended.webrtcEndpointName, webrtcEndpointName: subscriberExtended.webrtcEndpointName,
localSdp: subscriberExtended.localSdp, localSdp: subscriberExtended.localSdp,
remoteSdp: subscriberExtended.remoteSdp remoteSdp: subscriberExtended.remoteSdp

View File

@ -92,7 +92,7 @@ public abstract class MediaEndpoint {
private ListenerSubscription endpointSubscription = null; private ListenerSubscription endpointSubscription = null;
private final List<IceCandidate> receivedCandidateList = new LinkedList<IceCandidate>(); private final List<IceCandidate> receivedCandidateList = new LinkedList<IceCandidate>();
private final List<IceCandidate> generatedCandidateList = new LinkedList<IceCandidate>(); private final List<IceCandidate> gatheredCandidateList = new LinkedList<IceCandidate>();
private LinkedList<IceCandidate> candidates = new LinkedList<IceCandidate>(); private LinkedList<IceCandidate> candidates = new LinkedList<IceCandidate>();
public String selectedLocalIceCandidate; public String selectedLocalIceCandidate;
@ -534,7 +534,7 @@ public abstract class MediaEndpoint {
} }
webEndpoint.addIceCandidateFoundListener(event -> { webEndpoint.addIceCandidateFoundListener(event -> {
final IceCandidate candidate = event.getCandidate(); final IceCandidate candidate = event.getCandidate();
generatedCandidateList.add(candidate); gatheredCandidateList.add(candidate);
owner.sendIceCandidate(senderPublicId, endpointName, candidate); owner.sendIceCandidate(senderPublicId, endpointName, candidate);
}); });
} }
@ -612,17 +612,17 @@ public abstract class MediaEndpoint {
} }
Gson gson = new GsonBuilder().create(); Gson gson = new GsonBuilder().create();
JsonArray receivedCandidates = new JsonArray(); JsonArray receivedCandidates = new JsonArray();
Iterator<IceCandidate> it = this.receivedCandidateList.iterator(); Iterator<IceCandidate> it1 = this.receivedCandidateList.iterator();
while (it.hasNext()) { while (it1.hasNext()) {
receivedCandidates.add(gson.toJsonTree(it.next())); receivedCandidates.add(gson.toJsonTree(it1.next()));
} }
json.add("receivedCandidates", receivedCandidates); json.add("receivedCandidates", receivedCandidates);
JsonArray generatedCandidates = new JsonArray(); JsonArray gatheredCandidates = new JsonArray();
it = this.receivedCandidateList.iterator(); Iterator<IceCandidate> it2 = this.gatheredCandidateList.iterator();
while (it.hasNext()) { while (it2.hasNext()) {
generatedCandidates.add(gson.toJsonTree(it.next())); gatheredCandidates.add(gson.toJsonTree(it2.next()));
} }
json.add("generatedCandidates", generatedCandidates); json.add("gatheredCandidates", gatheredCandidates);
json.addProperty("localCandidate", this.selectedLocalIceCandidate); json.addProperty("localCandidate", this.selectedLocalIceCandidate);
json.addProperty("remoteCandidate", this.selectedRemoteIceCandidate); json.addProperty("remoteCandidate", this.selectedRemoteIceCandidate);