mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: avoid race condition on GET session (null values)
parent
dd0016671e
commit
bab46cdf8b
|
@ -31,6 +31,7 @@ import org.kurento.client.ErrorEvent;
|
||||||
import org.kurento.client.Filter;
|
import org.kurento.client.Filter;
|
||||||
import org.kurento.client.GenericMediaElement;
|
import org.kurento.client.GenericMediaElement;
|
||||||
import org.kurento.client.IceCandidate;
|
import org.kurento.client.IceCandidate;
|
||||||
|
import org.kurento.client.IceComponentState;
|
||||||
import org.kurento.client.MediaElement;
|
import org.kurento.client.MediaElement;
|
||||||
import org.kurento.client.MediaPipeline;
|
import org.kurento.client.MediaPipeline;
|
||||||
import org.kurento.client.MediaType;
|
import org.kurento.client.MediaType;
|
||||||
|
@ -665,7 +666,9 @@ public class KurentoParticipant extends Participant {
|
||||||
});
|
});
|
||||||
|
|
||||||
endpoint.getWebEndpoint().addIceComponentStateChangeListener(event -> {
|
endpoint.getWebEndpoint().addIceComponentStateChangeListener(event -> {
|
||||||
|
if (!event.getState().equals(IceComponentState.READY)) {
|
||||||
endpoint.kmsEvents.add(new KmsEvent(event, endpoint.createdAt()));
|
endpoint.kmsEvents.add(new KmsEvent(event, endpoint.createdAt()));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,7 @@ import org.kurento.client.OnIceCandidateEvent;
|
||||||
import org.kurento.client.RtpEndpoint;
|
import org.kurento.client.RtpEndpoint;
|
||||||
import org.kurento.client.SdpEndpoint;
|
import org.kurento.client.SdpEndpoint;
|
||||||
import org.kurento.client.WebRtcEndpoint;
|
import org.kurento.client.WebRtcEndpoint;
|
||||||
|
import org.kurento.client.internal.server.KurentoServerException;
|
||||||
import org.kurento.jsonrpc.JsonUtils;
|
import org.kurento.jsonrpc.JsonUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -500,7 +501,11 @@ public abstract class MediaEndpoint {
|
||||||
public JsonObject withStatsToJson() {
|
public JsonObject withStatsToJson() {
|
||||||
JsonObject json = new JsonObject();
|
JsonObject json = new JsonObject();
|
||||||
json.addProperty("createdAt", this.createdAt);
|
json.addProperty("createdAt", this.createdAt);
|
||||||
|
try {
|
||||||
json.addProperty("webrtcTagName", this.getEndpoint().getTag("name"));
|
json.addProperty("webrtcTagName", this.getEndpoint().getTag("name"));
|
||||||
|
} catch (KurentoServerException ex) {
|
||||||
|
json.addProperty("webrtcTagName", "NOT_FOUND");
|
||||||
|
}
|
||||||
json.add("receivedCandidates", new GsonBuilder().create().toJsonTree(this.receivedCandidateList));
|
json.add("receivedCandidates", new GsonBuilder().create().toJsonTree(this.receivedCandidateList));
|
||||||
json.addProperty("localCandidate", this.selectedLocalIceCandidate);
|
json.addProperty("localCandidate", this.selectedLocalIceCandidate);
|
||||||
json.addProperty("remoteCandidate", this.selectedRemoteIceCandidate);
|
json.addProperty("remoteCandidate", this.selectedRemoteIceCandidate);
|
||||||
|
|
|
@ -77,8 +77,16 @@ public class SubscriberEndpoint extends MediaEndpoint {
|
||||||
@Override
|
@Override
|
||||||
public JsonObject toJson() {
|
public JsonObject toJson() {
|
||||||
JsonObject json = super.toJson();
|
JsonObject json = super.toJson();
|
||||||
|
try {
|
||||||
json.addProperty("streamId", this.publisher.getEndpoint().getTag("name"));
|
json.addProperty("streamId", this.publisher.getEndpoint().getTag("name"));
|
||||||
|
} catch (NullPointerException ex) {
|
||||||
|
json.addProperty("streamId", "NOT_FOUND");
|
||||||
|
}
|
||||||
|
try {
|
||||||
json.addProperty("publisher", this.publisher.getEndpointName());
|
json.addProperty("publisher", this.publisher.getEndpointName());
|
||||||
|
} catch (NullPointerException ex) {
|
||||||
|
json.addProperty("publisher", "NOT_FOUND");
|
||||||
|
}
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue