ADD improved error handling
This commit is contained in:
@@ -13,6 +13,7 @@ import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import com.ddf.vodsystem.exceptions.FFMPEGException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -109,7 +110,6 @@ public class CompressionService {
|
||||
logger.info("FFMPEG starting...");
|
||||
|
||||
ProcessBuilder pb = buildCommand(job.getInputFile(), job.getOutputFile(), job.getClipConfig());
|
||||
//pb.redirectErrorStream(true);
|
||||
Process process = pb.start();
|
||||
job.setStatus(JobStatus.RUNNING);
|
||||
|
||||
@@ -127,6 +127,11 @@ public class CompressionService {
|
||||
}
|
||||
}
|
||||
|
||||
if (process.waitFor() != 0) {
|
||||
job.setStatus(JobStatus.FAILED);
|
||||
throw new FFMPEGException("FFMPEG process failed");
|
||||
}
|
||||
|
||||
job.setStatus(JobStatus.FINISHED);
|
||||
logger.info("FFMPEG finished");
|
||||
}
|
||||
|
||||
@@ -23,6 +23,12 @@ public class EditService {
|
||||
}
|
||||
}
|
||||
|
||||
if (clipConfig.getFileSize() != null) {
|
||||
if (clipConfig.getFileSize() < 100) {
|
||||
throw new IllegalArgumentException("File size cannot be less than 100kb");
|
||||
}
|
||||
}
|
||||
|
||||
job.setClipConfig(clipConfig);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user