diff --git a/openvidu-server/src/main/java/io/openvidu/server/core/SessionEventsHandler.java b/openvidu-server/src/main/java/io/openvidu/server/core/SessionEventsHandler.java index 1e3ae7f0..34fbc998 100644 --- a/openvidu-server/src/main/java/io/openvidu/server/core/SessionEventsHandler.java +++ b/openvidu-server/src/main/java/io/openvidu/server/core/SessionEventsHandler.java @@ -64,8 +64,6 @@ public class SessionEventsHandler { @Autowired protected OpenviduBuildInfo openviduBuildConfig; - protected Map recordingsToSendClientEvents = new ConcurrentHashMap<>(); - public void onSessionCreated(Session session) { CDR.recordSessionCreated(session); } @@ -381,13 +379,6 @@ public class SessionEventsHandler { result.addProperty(ProtocolElements.RECEIVEVIDEO_SDPANSWER_PARAM, sdpAnswer); } rpcNotificationService.sendResponse(participant.getParticipantPrivateId(), transactionId, result); - - if (participant.isRecorderParticipant()) { - recordingsToSendClientEvents.computeIfPresent(session.getSessionId(), (key, value) -> { - sendRecordingStartedNotification(session, value); - return null; - }); - } } public void onUnsubscribe(Participant participant, Integer transactionId, OpenViduException error) { @@ -556,9 +547,6 @@ public class SessionEventsHandler { public void sendRecordingStoppedNotification(Session session, Recording recording, EndReason reason) { - // Be sure to clean this map (this should return null) - recordingsToSendClientEvents.remove(session.getSessionId()); - // Filter participants by roles according to "OPENVIDU_RECORDING_NOTIFICATION" Set existingParticipants; try { @@ -713,10 +701,6 @@ public class SessionEventsHandler { Set subscribedParticipants) { } - public void storeRecordingToSendClientEvent(Recording recording) { - recordingsToSendClientEvents.put(recording.getSessionId(), recording); - } - protected Set filterParticipantsByRole(Set roles, Set participants) { return participants.stream().filter(part -> { if (part.isRecorderOrSttOrBroadcastParticipant()) { diff --git a/openvidu-server/src/main/java/io/openvidu/server/recording/service/RecordingManager.java b/openvidu-server/src/main/java/io/openvidu/server/recording/service/RecordingManager.java index 5edaf35d..ad360988 100644 --- a/openvidu-server/src/main/java/io/openvidu/server/recording/service/RecordingManager.java +++ b/openvidu-server/src/main/java/io/openvidu/server/recording/service/RecordingManager.java @@ -304,12 +304,8 @@ public class RecordingManager { this.cdr.recordRecordingStatusChanged(recording, null, recording.getCreatedAt(), Status.started); - if (!(OutputMode.COMPOSED.equals(properties.outputMode()) && properties.hasVideo())) { - // Directly send recording started notification for all cases except for - // COMPOSED recordings with video (will be sent on first RECORDER subscriber) - // Both INDIVIDUAL and COMPOSED_QUICK_START should notify immediately - this.sessionHandler.sendRecordingStartedNotification(session, recording); - } + this.sessionHandler.sendRecordingStartedNotification(session, recording); + if (session.getActivePublishers() == 0) { // Init automatic recording stop if no publishers when starting the recording log.info( @@ -318,6 +314,7 @@ public class RecordingManager { this.openviduConfig.getOpenviduRecordingAutostopTimeout()); this.initAutomaticRecordingStopThread(session, EndReason.automaticStop); } + return recording; } } finally { @@ -936,8 +933,6 @@ public class RecordingManager { || (sessionsRecordingsStarting.putIfAbsent(recording.getSessionId(), recording) != null)) { log.error("Concurrent session recording initialization. Aborting this thread"); throw new RuntimeException("Concurrent initialization of recording " + recording.getId()); - } else { - this.sessionHandler.storeRecordingToSendClientEvent(recording); } }