openvidu-server: refactor recordingStarted notification for COMPOSED with video

pull/803/head
pabloFuente 2023-04-19 12:56:03 +02:00
parent c646f66aab
commit 35a6e823b6
2 changed files with 3 additions and 24 deletions

View File

@ -64,8 +64,6 @@ public class SessionEventsHandler {
@Autowired
protected OpenviduBuildInfo openviduBuildConfig;
protected Map<String, Recording> 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<Participant> existingParticipants;
try {
@ -713,10 +701,6 @@ public class SessionEventsHandler {
Set<Participant> subscribedParticipants) {
}
public void storeRecordingToSendClientEvent(Recording recording) {
recordingsToSendClientEvents.put(recording.getSessionId(), recording);
}
protected Set<Participant> filterParticipantsByRole(Set<OpenViduRole> roles, Set<Participant> participants) {
return participants.stream().filter(part -> {
if (part.isRecorderOrSttOrBroadcastParticipant()) {

View File

@ -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);
}
}