openvidu-server: configure stun server for each MediaEndpoint

pull/437/head
pabloFuente 2020-04-15 19:32:29 +02:00
parent 079fd9de04
commit 0d426feb22
1 changed files with 51 additions and 4 deletions

View File

@ -284,14 +284,61 @@ public abstract class MediaEndpoint {
public void onSuccess(WebRtcEndpoint result) throws Exception { public void onSuccess(WebRtcEndpoint result) throws Exception {
webEndpoint = result; webEndpoint = result;
webEndpoint.setMaxVideoRecvBandwidth(maxRecvKbps); if (openviduConfig.getCoturnIp() != null && !openviduConfig.getCoturnIp().isEmpty()
webEndpoint.setMinVideoRecvBandwidth(minRecvKbps); && !openviduConfig.getCoturnIp().equals("localhost")) {
webEndpoint.setMaxVideoSendBandwidth(maxSendKbps); webEndpoint.setStunServerAddress(openviduConfig.getCoturnIp());
webEndpoint.setMinVideoSendBandwidth(minSendKbps); webEndpoint.setStunServerPort(3478);
}
endpointLatch.countDown(); endpointLatch.countDown();
log.trace("EP {}: Created a new WebRtcEndpoint", endpointName); log.trace("EP {}: Created a new WebRtcEndpoint", endpointName);
endpointSubscription = registerElemErrListener(webEndpoint); endpointSubscription = registerElemErrListener(webEndpoint);
// This can be done after unlocking latch. Not necessary to wait
webEndpoint.setMaxVideoRecvBandwidth(maxRecvKbps, new Continuation<Void>() {
@Override
public void onSuccess(Void result) throws Exception {
}
@Override
public void onError(Throwable cause) throws Exception {
log.error("Error setting max video receive bandwidth for endpoint {}: {}", endpointName,
cause.getMessage());
}
});
webEndpoint.setMinVideoRecvBandwidth(minRecvKbps, new Continuation<Void>() {
@Override
public void onSuccess(Void result) throws Exception {
}
@Override
public void onError(Throwable cause) throws Exception {
log.error("Error setting min video receive bandwidth for endpoint {}: {}", endpointName,
cause.getMessage());
}
});
webEndpoint.setMaxVideoSendBandwidth(maxSendKbps, new Continuation<Void>() {
@Override
public void onSuccess(Void result) throws Exception {
}
@Override
public void onError(Throwable cause) throws Exception {
log.error("Error setting max video send bandwidth for endpoint {}: {}", endpointName,
cause.getMessage());
}
});
webEndpoint.setMinVideoSendBandwidth(minSendKbps, new Continuation<Void>() {
@Override
public void onSuccess(Void result) throws Exception {
}
@Override
public void onError(Throwable cause) throws Exception {
log.error("Error setting min video send bandwidth for endpoint {}: {}", endpointName,
cause.getMessage());
}
});
} }
@Override @Override