forked from j62/ctbrec
Wait for stdout and stderr log threads to finish
This commit is contained in:
parent
b37178170b
commit
5ecad75b0d
|
@ -1,7 +1,7 @@
|
|||
3.0.3
|
||||
========================
|
||||
* Fix: Recordings didn't start for some MFC models
|
||||
* Fix: In some cases a lot of recordings have been created, because a recording
|
||||
* Fix: In some cases a lot of recordings have been created, because they
|
||||
failed immediately after start
|
||||
* Fix: Recorded models now don't switch their positions in the thumb overview
|
||||
* HLS downloads now try to update the segment playlist URL, if the playlist cannot
|
||||
|
|
|
@ -91,9 +91,14 @@ public class FfmpegMuxer {
|
|||
// @formatter:on
|
||||
LOG.debug("Command line: {}", Arrays.toString(cmdline));
|
||||
Process ffmpeg = Runtime.getRuntime().exec(cmdline);
|
||||
new Thread(new StreamRedirectThread(ffmpeg.getInputStream(), muxLogStream)).start();
|
||||
new Thread(new StreamRedirectThread(ffmpeg.getErrorStream(), muxLogStream)).start();
|
||||
return ffmpeg.waitFor();
|
||||
Thread stdout = new Thread(new StreamRedirectThread(ffmpeg.getInputStream(), muxLogStream));
|
||||
Thread stderr = new Thread(new StreamRedirectThread(ffmpeg.getErrorStream(), muxLogStream));
|
||||
stdout.start();
|
||||
stderr.start();
|
||||
int exitCode = ffmpeg.waitFor();
|
||||
stdout.join();
|
||||
stderr.join();
|
||||
return exitCode;
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
LOG.error("Interrupted while waiting for FFMPEG", e);
|
||||
|
|
|
@ -93,9 +93,13 @@ public class MergedHlsDownload extends HlsDownload {
|
|||
Process ffmpeg = Runtime.getRuntime().exec(cmdline, new String[0], playlist.getParentFile());
|
||||
int exitCode = 1;
|
||||
try (FileOutputStream mergeLogStream = new FileOutputStream(mergeLog)) {
|
||||
new Thread(new StreamRedirectThread(ffmpeg.getInputStream(), mergeLogStream)).start();
|
||||
new Thread(new StreamRedirectThread(ffmpeg.getErrorStream(), mergeLogStream)).start();
|
||||
Thread stdout = new Thread(new StreamRedirectThread(ffmpeg.getInputStream(), mergeLogStream));
|
||||
Thread stderr = new Thread(new StreamRedirectThread(ffmpeg.getErrorStream(), mergeLogStream));
|
||||
stdout.start();
|
||||
stderr.start();
|
||||
exitCode = ffmpeg.waitFor();
|
||||
stdout.join();
|
||||
stderr.join();
|
||||
mergeLogStream.flush();
|
||||
}
|
||||
if (exitCode == 0) {
|
||||
|
|
Loading…
Reference in New Issue