forked from j62/ctbrec
1
0
Fork 0

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,9 +412,12 @@ public class MergedFfmpegHlsDownload extends AbstractHlsDownload {
try { try {
boolean waitFor = ffmpeg.waitFor(45, TimeUnit.SECONDS); boolean waitFor = ffmpeg.waitFor(45, TimeUnit.SECONDS);
if (!waitFor && ffmpeg.isAlive()) { if (!waitFor && ffmpeg.isAlive()) {
LOG.info("FFmpeg didn't terminate. Destroying the process with force!"); ffmpeg.destroy();
ffmpeg.destroyForcibly(); if (ffmpeg.isAlive()) {
ffmpeg = null; LOG.info("FFmpeg didn't terminate. Destroying the process with force!");
ffmpeg.destroyForcibly();
ffmpeg = null;
}
} }
} catch (InterruptedException e) { } catch (InterruptedException e) {
LOG.error("Interrupted while waiting for FFmpeg to terminate"); LOG.error("Interrupted while waiting for FFmpeg to terminate");