mirror of https://github.com/OpenVidu/openvidu.git
openvidu recording container: set status failed if no media tracks
parent
c332612b7d
commit
a719b73e5e
|
@ -88,7 +88,14 @@ HAS_VIDEO_AUX=$(echo $INFO | jq '.streams[] | select(.codec_type == "video")')
|
||||||
if [ -z "$HAS_VIDEO_AUX" ]; then HAS_VIDEO=false; else HAS_VIDEO=true; fi
|
if [ -z "$HAS_VIDEO_AUX" ]; then HAS_VIDEO=false; else HAS_VIDEO=true; fi
|
||||||
SIZE=$(echo $INFO | jq '.format.size | tonumber')
|
SIZE=$(echo $INFO | jq '.format.size | tonumber')
|
||||||
DURATION=$(echo $INFO | jq '.format.duration | tonumber')
|
DURATION=$(echo $INFO | jq '.format.duration | tonumber')
|
||||||
STATUS="stopped"
|
|
||||||
|
if [[ "$HAS_AUDIO" == false && "$HAS_VIDEO" == false ]]
|
||||||
|
then
|
||||||
|
STATUS="failed"
|
||||||
|
else
|
||||||
|
STATUS="stopped"
|
||||||
|
fi
|
||||||
|
|
||||||
jq -c -r ".hasAudio=$HAS_AUDIO | .hasVideo=$HAS_VIDEO | .duration=$DURATION | .size=$SIZE | .status=\"$STATUS\"" "/recordings/$VIDEO_ID/.recording.$VIDEO_ID" > $TMP && mv $TMP /recordings/$VIDEO_ID/.recording.$VIDEO_ID
|
jq -c -r ".hasAudio=$HAS_AUDIO | .hasVideo=$HAS_VIDEO | .duration=$DURATION | .size=$SIZE | .status=\"$STATUS\"" "/recordings/$VIDEO_ID/.recording.$VIDEO_ID" > $TMP && mv $TMP /recordings/$VIDEO_ID/.recording.$VIDEO_ID
|
||||||
|
|
||||||
### Generate video thumbnail ###
|
### Generate video thumbnail ###
|
||||||
|
|
|
@ -284,14 +284,14 @@ public class ComposedRecordingService extends RecordingService {
|
||||||
try {
|
try {
|
||||||
stopped = latch.await(60, TimeUnit.SECONDS);
|
stopped = latch.await(60, TimeUnit.SECONDS);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
recording.setStatus(io.openvidu.java.client.Recording.Status.failed);
|
failRecordingCompletion(recording, containerId,
|
||||||
failRecordingCompletion(containerId, new OpenViduException(Code.RECORDING_COMPLETION_ERROR_CODE,
|
new OpenViduException(Code.RECORDING_COMPLETION_ERROR_CODE,
|
||||||
"The recording completion process has been unexpectedly interrupted"));
|
"The recording completion process has been unexpectedly interrupted"));
|
||||||
}
|
}
|
||||||
if (!stopped) {
|
if (!stopped) {
|
||||||
recording.setStatus(io.openvidu.java.client.Recording.Status.failed);
|
failRecordingCompletion(recording, containerId,
|
||||||
failRecordingCompletion(containerId, new OpenViduException(Code.RECORDING_COMPLETION_ERROR_CODE,
|
new OpenViduException(Code.RECORDING_COMPLETION_ERROR_CODE,
|
||||||
"The recording completion process couldn't finish in 60 seconds"));
|
"The recording completion process couldn't finish in 60 seconds"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove container
|
// Remove container
|
||||||
|
@ -305,8 +305,6 @@ public class ComposedRecordingService extends RecordingService {
|
||||||
if (!infoUtils.hasVideo()) {
|
if (!infoUtils.hasVideo()) {
|
||||||
log.error("COMPOSED recording {} with hasVideo=true has not video track", recordingId);
|
log.error("COMPOSED recording {} with hasVideo=true has not video track", recordingId);
|
||||||
recording.setStatus(io.openvidu.java.client.Recording.Status.failed);
|
recording.setStatus(io.openvidu.java.client.Recording.Status.failed);
|
||||||
recording.setHasAudio(false);
|
|
||||||
recording.setHasVideo(false);
|
|
||||||
} else {
|
} else {
|
||||||
recording.setStatus(io.openvidu.java.client.Recording.Status.stopped);
|
recording.setStatus(io.openvidu.java.client.Recording.Status.stopped);
|
||||||
recording.setDuration(infoUtils.getDurationInSeconds());
|
recording.setDuration(infoUtils.getDurationInSeconds());
|
||||||
|
@ -441,7 +439,9 @@ public class ComposedRecordingService extends RecordingService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void failRecordingCompletion(String containerId, OpenViduException e) throws OpenViduException {
|
private void failRecordingCompletion(Recording recording, String containerId, OpenViduException e)
|
||||||
|
throws OpenViduException {
|
||||||
|
recording.setStatus(io.openvidu.java.client.Recording.Status.failed);
|
||||||
this.stopDockerContainer(containerId);
|
this.stopDockerContainer(containerId);
|
||||||
this.removeDockerContainer(containerId);
|
this.removeDockerContainer(containerId);
|
||||||
throw e;
|
throw e;
|
||||||
|
|
Loading…
Reference in New Issue