openvidu-server: fixes for supporting audio/video only recordings with audio/video only streams

pull/203/head
pabloFuente 2019-01-24 15:09:39 +01:00
parent 718c7f9e63
commit 82d8caa915
1 changed files with 9 additions and 3 deletions

View File

@ -88,7 +88,9 @@ public class SingleStreamRecordingService extends RecordingService {
recorders.put(session.getSessionId(), new ConcurrentHashMap<String, RecorderEndpointWrapper>()); recorders.put(session.getSessionId(), new ConcurrentHashMap<String, RecorderEndpointWrapper>());
final CountDownLatch recordingStartedCountdown = new CountDownLatch(session.getActivePublishers()); final int activePublishers = session.getActivePublishers();
final CountDownLatch recordingStartedCountdown = new CountDownLatch(activePublishers);
int incompatibleMediaTypePublishers = 0;
for (Participant p : session.getParticipants()) { for (Participant p : session.getParticipants()) {
if (p.isStreaming()) { if (p.isStreaming()) {
@ -100,6 +102,8 @@ public class SingleStreamRecordingService extends RecordingService {
log.error( log.error(
"Cannot start single stream recorder for stream {} in session {}: {}. Skipping to next stream being published", "Cannot start single stream recorder for stream {} in session {}: {}. Skipping to next stream being published",
p.getPublisherStreamId(), session.getSessionId(), e.getMessage()); p.getPublisherStreamId(), session.getSessionId(), e.getMessage());
incompatibleMediaTypePublishers++;
recordingStartedCountdown.countDown();
continue; continue;
} }
this.startRecorderEndpointForPublisherEndpoint(session, recordingId, profile, p, this.startRecorderEndpointForPublisherEndpoint(session, recordingId, profile, p,
@ -117,9 +121,10 @@ public class SingleStreamRecordingService extends RecordingService {
log.error("Exception while waiting for state change", e); log.error("Exception while waiting for state change", e);
} }
if (session.getActivePublishers() == 0) { if (activePublishers == 0 || incompatibleMediaTypePublishers == activePublishers) {
// Recording started for a session with some user connected but no publishers // Recording started for a session with some user connected but no publishers
// Must create recording root folder for storing metadata archive // or with no publisher having a compatible media type stream with the recording
// configuration. Must create recording root folder for storing metadata archive
this.fileWriter.createFolder(this.openviduConfig.getOpenViduRecordingPath() + recording.getId()); this.fileWriter.createFolder(this.openviduConfig.getOpenViduRecordingPath() + recording.getId());
} }
@ -241,6 +246,7 @@ public class SingleStreamRecordingService extends RecordingService {
finalWrapper.getRecorder().stop(); finalWrapper.getRecorder().stop();
} else { } else {
log.error("Stream {} wasn't being recorded in session {}", streamId, sessionId); log.error("Stream {} wasn't being recorded in session {}", streamId, sessionId);
globalStopLatch.countDown();
} }
} }