Try to terminate FFmpeg before killing it

This commit is contained in:
0xb00bface 2020-08-30 13:41:43 +02:00
parent d7d3e2944b
commit f0713b96f5
1 changed files with 6 additions and 3 deletions

View File

@ -412,10 +412,13 @@ public class MergedFfmpegHlsDownload extends AbstractHlsDownload {
try {
boolean waitFor = ffmpeg.waitFor(45, TimeUnit.SECONDS);
if (!waitFor && ffmpeg.isAlive()) {
ffmpeg.destroy();
if (ffmpeg.isAlive()) {
LOG.info("FFmpeg didn't terminate. Destroying the process with force!");
ffmpeg.destroyForcibly();
ffmpeg = null;
}
}
} catch (InterruptedException e) {
LOG.error("Interrupted while waiting for FFmpeg to terminate");
Thread.currentThread().interrupt();