mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: Added Network Quality support
parent
c24606aca7
commit
417d645e45
|
@ -773,20 +773,6 @@ public class OpenviduConfig {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Double asNonNegativeDouble(String property) {
|
|
||||||
try {
|
|
||||||
Double doubleValue = Double.parseDouble(getValue(property));
|
|
||||||
|
|
||||||
if (doubleValue < 0) {
|
|
||||||
addError(property, "Is not a non negative double");
|
|
||||||
}
|
|
||||||
return doubleValue;
|
|
||||||
} catch (NumberFormatException e) {
|
|
||||||
addError(property, "Is not a non negative doubleValue");
|
|
||||||
return 0.0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This method checks all types of Internet addresses (IPv4, IPv6 and Domains)
|
* This method checks all types of Internet addresses (IPv4, IPv6 and Domains)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -38,6 +38,10 @@ public class Participant {
|
||||||
protected GeoLocation location; // Location of the participant
|
protected GeoLocation location; // Location of the participant
|
||||||
protected String platform; // Platform used by the participant to connect to the session
|
protected String platform; // Platform used by the participant to connect to the session
|
||||||
protected EndpointType endpointType; // Type of participant (web participant, IP cam participant...)
|
protected EndpointType endpointType; // Type of participant (web participant, IP cam participant...)
|
||||||
|
protected Integer videoWidth = 0;
|
||||||
|
protected Integer videoHeight = 0;
|
||||||
|
protected Boolean videoActive = false;
|
||||||
|
protected Boolean audioActive = false;
|
||||||
|
|
||||||
protected boolean streaming = false;
|
protected boolean streaming = false;
|
||||||
protected volatile boolean closed = false;
|
protected volatile boolean closed = false;
|
||||||
|
@ -141,6 +145,38 @@ public class Participant {
|
||||||
public EndpointType getEndpointType() {
|
public EndpointType getEndpointType() {
|
||||||
return this.endpointType;
|
return this.endpointType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getVideoWidth() {
|
||||||
|
return videoWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVideoWidth(Integer videoWidth) {
|
||||||
|
this.videoWidth = videoWidth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getVideoHeight() {
|
||||||
|
return videoHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVideoHeight(Integer videoHeight) {
|
||||||
|
this.videoHeight = videoHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean isVideoActive() {
|
||||||
|
return videoActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVideoActive(Boolean videoActive) {
|
||||||
|
this.videoActive = videoActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean isAudioActive() {
|
||||||
|
return audioActive;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAudioActive(Boolean audioActive) {
|
||||||
|
this.audioActive = audioActive;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isStreaming() {
|
public boolean isStreaming() {
|
||||||
return streaming;
|
return streaming;
|
||||||
|
|
|
@ -558,6 +558,18 @@ public class SessionEventsHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onVideoData(Participant participant, Integer transactionId, Integer height, Integer width,
|
||||||
|
Boolean videoActive, Boolean audioActive) {
|
||||||
|
participant.setVideoHeight(height);
|
||||||
|
participant.setVideoWidth(width);
|
||||||
|
participant.setVideoActive(videoActive);
|
||||||
|
participant.setAudioActive(audioActive);
|
||||||
|
log.info(
|
||||||
|
"Video data of participant {} was initialized. height:{}, width:{}, isVideoActive: {}, isAudioActive: {}",
|
||||||
|
participant.getParticipantPublicId(), height, width, videoActive, audioActive);
|
||||||
|
rpcNotificationService.sendResponse(participant.getParticipantPrivateId(), transactionId, new JsonObject());
|
||||||
|
}
|
||||||
|
|
||||||
public void closeRpcSession(String participantPrivateId) {
|
public void closeRpcSession(String participantPrivateId) {
|
||||||
this.rpcNotificationService.closeRpcSession(participantPrivateId);
|
this.rpcNotificationService.closeRpcSession(participantPrivateId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,6 +165,8 @@ public abstract class SessionManager {
|
||||||
|
|
||||||
public abstract String getParticipantPrivateIdFromStreamId(String sessionId, String streamId)
|
public abstract String getParticipantPrivateIdFromStreamId(String sessionId, String streamId)
|
||||||
throws OpenViduException;
|
throws OpenViduException;
|
||||||
|
|
||||||
|
public abstract void onVideoData(Participant participant, Integer transactionId, Integer height, Integer width, Boolean videoActive, Boolean audioActive);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a Session given its id
|
* Returns a Session given its id
|
||||||
|
|
|
@ -1107,6 +1107,11 @@ public class KurentoSessionManager extends SessionManager {
|
||||||
Session session = this.getSession(sessionId);
|
Session session = this.getSession(sessionId);
|
||||||
return ((KurentoSession) session).getParticipantPrivateIdFromStreamId(streamId);
|
return ((KurentoSession) session).getParticipantPrivateIdFromStreamId(streamId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onVideoData(Participant participant, Integer transactionId, Integer height, Integer width, Boolean videoActive, Boolean audioActive) {
|
||||||
|
sessionEventsHandler.onVideoData(participant, transactionId, height, width, videoActive, audioActive);
|
||||||
|
}
|
||||||
|
|
||||||
private void applyFilterInPublisher(KurentoParticipant kParticipant, KurentoFilter filter)
|
private void applyFilterInPublisher(KurentoParticipant kParticipant, KurentoFilter filter)
|
||||||
throws OpenViduException {
|
throws OpenViduException {
|
||||||
|
|
|
@ -165,6 +165,9 @@ public class RpcHandler extends DefaultJsonRpcHandler<JsonObject> {
|
||||||
case ProtocolElements.RECONNECTSTREAM_METHOD:
|
case ProtocolElements.RECONNECTSTREAM_METHOD:
|
||||||
reconnectStream(rpcConnection, request);
|
reconnectStream(rpcConnection, request);
|
||||||
break;
|
break;
|
||||||
|
case ProtocolElements.VIDEODATA_METHOD:
|
||||||
|
updateVideoData(rpcConnection, request);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
log.error("Unrecognized request {}", request);
|
log.error("Unrecognized request {}", request);
|
||||||
break;
|
break;
|
||||||
|
@ -633,6 +636,20 @@ public class RpcHandler extends DefaultJsonRpcHandler<JsonObject> {
|
||||||
new JsonObject(), e);
|
new JsonObject(), e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateVideoData(RpcConnection rpcConnection, Request<JsonObject> request) {
|
||||||
|
Participant participant;
|
||||||
|
try {
|
||||||
|
participant = sanityCheckOfSession(rpcConnection, "videoData");
|
||||||
|
int height = getIntParam(request, "height");
|
||||||
|
int width = getIntParam(request, "width");
|
||||||
|
boolean videoActive = getBooleanParam(request, "videoActive");
|
||||||
|
boolean audioActive = getBooleanParam(request, "audioActive");
|
||||||
|
sessionManager.onVideoData(participant, request.getId(), height, width, videoActive, audioActive);
|
||||||
|
} catch (OpenViduException e) {
|
||||||
|
log.error("Error getting video data: {}", e.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void leaveRoomAfterConnClosed(String participantPrivateId, EndReason reason) {
|
public void leaveRoomAfterConnClosed(String participantPrivateId, EndReason reason) {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue