From 1c5bcaef3550fff9e783dbe49434dedecb1623fe Mon Sep 17 00:00:00 2001 From: 0xboobface <0xboobface@gmail.com> Date: Sun, 9 Sep 2018 14:30:21 +0200 Subject: [PATCH] Make sure the streamer is stopped The streamer has to be stopped, when the download is stopped or terminates to release the file handle of the recording and to stop the merge thread --- src/main/java/ctbrec/recorder/download/MergedHlsDownload.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/ctbrec/recorder/download/MergedHlsDownload.java b/src/main/java/ctbrec/recorder/download/MergedHlsDownload.java index 2b6f5b84..35976de9 100644 --- a/src/main/java/ctbrec/recorder/download/MergedHlsDownload.java +++ b/src/main/java/ctbrec/recorder/download/MergedHlsDownload.java @@ -65,6 +65,7 @@ public class MergedHlsDownload extends AbstractHlsDownload { throw new IOException("Couldn't parse HLS playlist", e); } finally { alive = false; + streamer.stop(); LOG.debug("Download for terminated"); } } @@ -107,6 +108,7 @@ public class MergedHlsDownload extends AbstractHlsDownload { throw new IOException("Couldn't download segment", e); } finally { alive = false; + streamer.stop(); LOG.debug("Download for {} terminated", model); } } @@ -159,7 +161,6 @@ public class MergedHlsDownload extends AbstractHlsDownload { if(livestreamDownload) { while(!mergeQueue.isEmpty()) { try { - LOG.debug("Writing segment"); writeSegment(mergeQueue.poll()); } catch (InterruptedException e) { if(running) { @@ -209,6 +210,7 @@ public class MergedHlsDownload extends AbstractHlsDownload { public void stop() { running = false; alive = false; + streamer.stop(); LOG.debug("Download stopped"); }