pabloFuente 2023-11-03 12:35:53 +01:00
parent d9d524b23c
commit a830033388
1 changed files with 24 additions and 22 deletions

View File

@ -690,8 +690,7 @@ public class RecordingManager {
if (session.isClosed()) { if (session.isClosed()) {
return; return;
} }
if (session.getParticipants().size() == 0 if (session.onlyRecorderAndOrSttAndOrBroadcastParticipant()) {
|| session.onlyRecorderAndOrSttAndOrBroadcastParticipant()) {
// Close session if there are no participants connected (RECORDER/STT/BROADCAST // Close session if there are no participants connected (RECORDER/STT/BROADCAST
// do not count) and publishing // do not count) and publishing
log.info("Closing session {} after automatic stop of recording {}", log.info("Closing session {} after automatic stop of recording {}",
@ -737,23 +736,25 @@ public class RecordingManager {
ScheduledFuture<?> future = this.automaticRecordingStopThreads.remove(session.getSessionId()); ScheduledFuture<?> future = this.automaticRecordingStopThreads.remove(session.getSessionId());
if (future != null) { if (future != null) {
boolean cancelled = future.cancel(false); boolean cancelled = future.cancel(false);
try { if (session.onlyRecorderAndOrSttAndOrBroadcastParticipant()) {
if (session.closingLock.writeLock().tryLock(15, TimeUnit.SECONDS)) {
try {
if (session.isClosed()) {
return false;
}
if (session.getParticipants().size() == 0
|| session.onlyRecorderAndOrSttAndOrBroadcastParticipant()) {
// Close session if there are no participants connected (except for // Close session if there are no participants connected (except for
// RECORDER/STT/BROADCAST). This code will only be executed if recording is // RECORDER/STT/BROADCAST). This code will only be executed if recording is
// manually stopped during the automatic stop timeout, so the session must be // manually stopped during the automatic stop timeout, so the session must be
// also closed // also closed
try {
if (session.closingLock.writeLock().tryLock(15, TimeUnit.SECONDS)) {
try {
if (!session.onlyRecorderAndOrSttAndOrBroadcastParticipant()) {
// Somebody connected after acquiring the lock. Cancel session close up
return true;
}
if (session.isClosed()) {
return false;
}
log.info( log.info(
"Ongoing recording of session {} was explicetly stopped within timeout for automatic recording stop. Closing session", "Ongoing recording of session {} was explicetly stopped within timeout for automatic recording stop. Closing session",
session.getSessionId()); session.getSessionId());
sessionManager.closeSessionAndEmptyCollections(session, reason, false); sessionManager.closeSessionAndEmptyCollections(session, reason, false);
}
} finally { } finally {
session.closingLock.writeLock().unlock(); session.closingLock.writeLock().unlock();
} }
@ -767,6 +768,7 @@ public class RecordingManager {
"InterruptedException while waiting for Session {} closing lock to be available for aborting automatic recording stop thred", "InterruptedException while waiting for Session {} closing lock to be available for aborting automatic recording stop thred",
session.getSessionId()); session.getSessionId());
} }
}
return cancelled; return cancelled;
} else { } else {
return true; return true;