Skip to content
Snippets Groups Projects
Commit 488d7c44 authored by srosse's avatar srosse
Browse files

OO-4276: catch more case to break the transcoding queue

parent 73dcbb0b
No related branches found
No related tags found
No related merge requests found
...@@ -54,10 +54,6 @@ import org.quartz.JobExecutionException; ...@@ -54,10 +54,6 @@ import org.quartz.JobExecutionException;
public class VideoTranscodingJob extends JobWithDB { public class VideoTranscodingJob extends JobWithDB {
private ArrayList<String> resolutionsWithProfile = new ArrayList<>(Arrays.asList("1080", "720", "480")); private ArrayList<String> resolutionsWithProfile = new ArrayList<>(Arrays.asList("1080", "720", "480"));
/**
*
* @see org.olat.core.commons.services.scheduler.JobWithDB#executeWithDB(org.quartz.JobExecutionContext)
*/
@Override @Override
public void executeWithDB(JobExecutionContext context) throws JobExecutionException { public void executeWithDB(JobExecutionContext context) throws JobExecutionException {
// uses StatefulJob interface to prevent concurrent job execution // uses StatefulJob interface to prevent concurrent job execution
...@@ -80,11 +76,24 @@ public class VideoTranscodingJob extends JobWithDB { ...@@ -80,11 +76,24 @@ public class VideoTranscodingJob extends JobWithDB {
// Find first one to work with // Find first one to work with
boolean allOk = true; boolean allOk = true;
for(VideoTranscoding videoTranscoding = getNextVideo(); videoTranscoding != null; videoTranscoding = getNextVideo()) { for(VideoTranscoding videoTranscoding = getNextVideo(); videoTranscoding != null; videoTranscoding = getNextVideo()) {
if(cancelTranscoding()) {
break;
}
allOk &= forkTranscodingProcess(videoTranscoding); allOk &= forkTranscodingProcess(videoTranscoding);
} }
return allOk; return allOk;
} }
private boolean cancelTranscoding() {
try {
VideoModule videoModule = CoreSpringFactory.getImpl(VideoModule.class);
return (!videoModule.isTranscodingLocal() || !videoModule.isTranscodingEnabled());
} catch (Exception e) {
log.error("", e);
return true;
}
}
private VideoTranscoding getNextVideo() { private VideoTranscoding getNextVideo() {
VideoManager videoManager = CoreSpringFactory.getImpl(VideoManager.class); VideoManager videoManager = CoreSpringFactory.getImpl(VideoManager.class);
List<VideoTranscoding> videoTranscodings = videoManager.getVideoTranscodingsPendingAndInProgress(); List<VideoTranscoding> videoTranscodings = videoManager.getVideoTranscodingsPendingAndInProgress();
...@@ -170,7 +179,7 @@ public class VideoTranscodingJob extends JobWithDB { ...@@ -170,7 +179,7 @@ public class VideoTranscodingJob extends JobWithDB {
ProcessBuilder builder = new ProcessBuilder(cmd); ProcessBuilder builder = new ProcessBuilder(cmd);
process = builder.start(); process = builder.start();
return updateVideoTranscodingFromProcessOutput(process, videoTranscoding, transcodedFile); return updateVideoTranscodingFromProcessOutput(process, videoTranscoding, transcodedFile);
} catch (IOException e) { } catch (Exception e) {
log.error ("Could not spawn convert sub process", e); log.error ("Could not spawn convert sub process", e);
return false; return false;
} finally { } finally {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment