mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: reset MediaPipeline latch on KurentoSession reset
parent
42cf3b4841
commit
2551e131ad
|
@ -48,6 +48,7 @@ public class KurentoSession extends Session {
|
||||||
|
|
||||||
private MediaPipeline pipeline;
|
private MediaPipeline pipeline;
|
||||||
private CountDownLatch pipelineLatch = new CountDownLatch(1);
|
private CountDownLatch pipelineLatch = new CountDownLatch(1);
|
||||||
|
private Throwable pipelineCreationErrorCause;
|
||||||
|
|
||||||
private Kms kms;
|
private Kms kms;
|
||||||
private KurentoSessionEventsHandler kurentoSessionHandler;
|
private KurentoSessionEventsHandler kurentoSessionHandler;
|
||||||
|
@ -219,6 +220,7 @@ public class KurentoSession extends Session {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onError(Throwable cause) throws Exception {
|
public void onError(Throwable cause) throws Exception {
|
||||||
|
pipelineCreationErrorCause = cause;
|
||||||
pipelineLatch.countDown();
|
pipelineLatch.countDown();
|
||||||
log.error("SESSION {}: Failed to create MediaPipeline", sessionId, cause);
|
log.error("SESSION {}: Failed to create MediaPipeline", sessionId, cause);
|
||||||
}
|
}
|
||||||
|
@ -228,8 +230,11 @@ public class KurentoSession extends Session {
|
||||||
pipelineLatch.countDown();
|
pipelineLatch.countDown();
|
||||||
}
|
}
|
||||||
if (getPipeline() == null) {
|
if (getPipeline() == null) {
|
||||||
throw new OpenViduException(Code.ROOM_CANNOT_BE_CREATED_ERROR_CODE,
|
final String message = pipelineCreationErrorCause != null
|
||||||
"Unable to create media pipeline for session '" + sessionId + "'");
|
? pipelineCreationErrorCause.getLocalizedMessage()
|
||||||
|
: "Unable to create media pipeline for session '" + sessionId + "'";
|
||||||
|
pipelineCreationErrorCause = null;
|
||||||
|
throw new OpenViduException(Code.ROOM_CANNOT_BE_CREATED_ERROR_CODE, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
pipeline.addErrorListener(new EventListener<ErrorEvent>() {
|
pipeline.addErrorListener(new EventListener<ErrorEvent>() {
|
||||||
|
@ -246,6 +251,10 @@ public class KurentoSession extends Session {
|
||||||
|
|
||||||
private void closePipeline(Runnable callback) {
|
private void closePipeline(Runnable callback) {
|
||||||
synchronized (pipelineReleaseLock) {
|
synchronized (pipelineReleaseLock) {
|
||||||
|
|
||||||
|
this.pipelineLatch = new CountDownLatch(1);
|
||||||
|
this.pipelineCreationErrorCause = null;
|
||||||
|
|
||||||
if (pipeline == null) {
|
if (pipeline == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,7 @@ public abstract class KmsManager {
|
||||||
private final Logger log = LoggerFactory.getLogger(KmsManager.class);
|
private final Logger log = LoggerFactory.getLogger(KmsManager.class);
|
||||||
|
|
||||||
// Using KMS websocket uris as unique identifiers
|
// Using KMS websocket uris as unique identifiers
|
||||||
private Map<String, Kms> kmss = new ConcurrentHashMap<>();
|
protected Map<String, Kms> kmss = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
private Iterator<Kms> usageIterator = null;
|
private Iterator<Kms> usageIterator = null;
|
||||||
|
|
||||||
|
@ -82,13 +82,6 @@ public abstract class KmsManager {
|
||||||
this.kmss.remove(kms.getUri());
|
this.kmss.remove(kms.getUri());
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized Kms getKms(String sessionId) {
|
|
||||||
if (usageIterator == null || !usageIterator.hasNext()) {
|
|
||||||
usageIterator = kmss.values().iterator();
|
|
||||||
}
|
|
||||||
return usageIterator.next();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a {@link Kms} using a round-robin strategy.
|
* Returns a {@link Kms} using a round-robin strategy.
|
||||||
*
|
*
|
||||||
|
|
|
@ -2,6 +2,7 @@ server.address: 0.0.0.0
|
||||||
server.ssl.enabled: true
|
server.ssl.enabled: true
|
||||||
openvidu.recording.version: 2.9.0
|
openvidu.recording.version: 2.9.0
|
||||||
logging.level.root=info
|
logging.level.root=info
|
||||||
|
spring.main.allow-bean-definition-overriding: true
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue