openvidu-server: automatic recording cancelation also for ALWAYS recordings

pull/508/head
pabloFuente 2020-06-12 12:16:36 +02:00
parent 26f6112b72
commit d5b3b9dde7
1 changed files with 8 additions and 4 deletions

View File

@ -129,7 +129,8 @@ public class KurentoSessionManager extends SessionManager {
} }
} else { } else {
String error = "Timeout of " + KmsManager.MAX_SECONDS_LOCK_WAIT + " seconds waiting to acquire lock"; String error = "Timeout of " + KmsManager.MAX_SECONDS_LOCK_WAIT
+ " seconds waiting to acquire lock";
log.error(error); log.error(error);
sessionEventsHandler.onParticipantJoined(participant, sessionId, null, transactionId, sessionEventsHandler.onParticipantJoined(participant, sessionId, null, transactionId,
new OpenViduException(Code.ROOM_CANNOT_BE_CREATED_ERROR_CODE, error)); new OpenViduException(Code.ROOM_CANNOT_BE_CREATED_ERROR_CODE, error));
@ -398,6 +399,8 @@ public class KurentoSessionManager extends SessionManager {
&& MediaMode.ROUTED.equals(kSession.getSessionProperties().mediaMode()) && MediaMode.ROUTED.equals(kSession.getSessionProperties().mediaMode())
&& kSession.getActivePublishers() == 0) { && kSession.getActivePublishers() == 0) {
// There were no previous publishers in the session
try { try {
if (kSession.recordingLock.tryLock(15, TimeUnit.SECONDS)) { if (kSession.recordingLock.tryLock(15, TimeUnit.SECONDS)) {
try { try {
@ -406,15 +409,16 @@ public class KurentoSessionManager extends SessionManager {
&& !recordingManager.sessionIsBeingRecorded(kSession.getSessionId()) && !recordingManager.sessionIsBeingRecorded(kSession.getSessionId())
&& !kSession.recordingManuallyStopped.get()) { && !kSession.recordingManuallyStopped.get()) {
// Start automatic recording for sessions configured with RecordingMode.ALWAYS // Start automatic recording for sessions configured with RecordingMode.ALWAYS
// that have not been been manually stopped
new Thread(() -> { new Thread(() -> {
recordingManager.startRecording(kSession, new RecordingProperties.Builder().name("") recordingManager.startRecording(kSession, new RecordingProperties.Builder().name("")
.outputMode(kSession.getSessionProperties().defaultOutputMode()) .outputMode(kSession.getSessionProperties().defaultOutputMode())
.recordingLayout(kSession.getSessionProperties().defaultRecordingLayout()) .recordingLayout(kSession.getSessionProperties().defaultRecordingLayout())
.customLayout(kSession.getSessionProperties().defaultCustomLayout()).build()); .customLayout(kSession.getSessionProperties().defaultCustomLayout()).build());
}).start(); }).start();
} else if (RecordingMode.MANUAL.equals(kSession.getSessionProperties().recordingMode()) } else if (recordingManager.sessionIsBeingRecorded(kSession.getSessionId())) {
&& recordingManager.sessionIsBeingRecorded(kSession.getSessionId())) { // Abort automatic recording stop thread for any recorded session in which a
// Abort automatic recording stop (user published before timeout) // user published before timeout
log.info( log.info(
"Participant {} published before timeout finished. Aborting automatic recording stop", "Participant {} published before timeout finished. Aborting automatic recording stop",
participant.getParticipantPublicId()); participant.getParticipantPublicId());