openvidu-server: allow recordings in waiting-idle-to-terminate Media Nodes

pull/570/head
pabloFuente 2020-11-26 13:46:29 +01:00
parent da617a8537
commit b305c9211f
4 changed files with 8 additions and 4 deletions

View File

@ -54,7 +54,7 @@ public class FixedOneKmsManager extends KmsManager {
} }
@Override @Override
public boolean isMediaNodeRunning(String mediaNodeId) { public boolean isMediaNodeAvailableForRecording(String mediaNodeId) {
return true; return true;
} }

View File

@ -357,7 +357,7 @@ public abstract class KmsManager {
public abstract List<Kms> initializeKurentoClients(List<KmsProperties> kmsProperties, boolean disconnectUponFailure) public abstract List<Kms> initializeKurentoClients(List<KmsProperties> kmsProperties, boolean disconnectUponFailure)
throws Exception; throws Exception;
public abstract boolean isMediaNodeRunning(String mediaNodeId); public abstract boolean isMediaNodeAvailableForRecording(String mediaNodeId);
@PostConstruct @PostConstruct
protected abstract void postConstructInitKurentoClients(); protected abstract void postConstructInitKurentoClients();

View File

@ -269,7 +269,7 @@ public class RecordingManager {
// 1. INCREMENT ACTIVE RECORDINGS OF MEDIA NODE HERE // 1. INCREMENT ACTIVE RECORDINGS OF MEDIA NODE HERE
((KurentoSession) session).getKms().incrementActiveRecordings(); ((KurentoSession) session).getKms().incrementActiveRecordings();
// 2. CHECK THAT MEDIA NODE HAS RUNNING STATUS. IF NOT THEN FAIL RECORDING START // 2. CHECK THAT MEDIA NODE HAS RUNNING STATUS. IF NOT THEN FAIL RECORDING START
if (!kmsManager.isMediaNodeRunning(properties.mediaNode())) { if (!kmsManager.isMediaNodeAvailableForRecording(properties.mediaNode())) {
throw new OpenViduException(Code.MEDIA_NODE_STATUS_WRONG, throw new OpenViduException(Code.MEDIA_NODE_STATUS_WRONG,
"Media Node " + properties.mediaNode() + " status is not \"running\""); "Media Node " + properties.mediaNode() + " status is not \"running\"");
} }

View File

@ -49,6 +49,7 @@ import com.google.gson.JsonObject;
import com.google.gson.JsonParser; import com.google.gson.JsonParser;
import io.openvidu.client.OpenViduException; import io.openvidu.client.OpenViduException;
import io.openvidu.client.OpenViduException.Code;
import io.openvidu.client.internal.ProtocolElements; import io.openvidu.client.internal.ProtocolElements;
import io.openvidu.java.client.ConnectionProperties; import io.openvidu.java.client.ConnectionProperties;
import io.openvidu.java.client.ConnectionType; import io.openvidu.java.client.ConnectionType;
@ -379,8 +380,11 @@ public class SessionRestController {
return new ResponseEntity<>(startedRecording.toJson().toString(), RestUtils.getResponseHeaders(), return new ResponseEntity<>(startedRecording.toJson().toString(), RestUtils.getResponseHeaders(),
HttpStatus.OK); HttpStatus.OK);
} catch (OpenViduException e) { } catch (OpenViduException e) {
HttpStatus status = e.getCodeValue() == Code.MEDIA_NODE_STATUS_WRONG.getValue()
? HttpStatus.SERVICE_UNAVAILABLE
: HttpStatus.INTERNAL_SERVER_ERROR;
return new ResponseEntity<>("Error starting recording: " + e.getMessage(), RestUtils.getResponseHeaders(), return new ResponseEntity<>("Error starting recording: " + e.getMessage(), RestUtils.getResponseHeaders(),
HttpStatus.INTERNAL_SERVER_ERROR); status);
} }
} }