From c1373fba17e35ac12142cab1e1443de3672b258d Mon Sep 17 00:00:00 2001 From: Erik Zandvliet Date: Fri, 20 Oct 2017 14:23:29 +0200 Subject: [PATCH] Fixes hls crash on non-existing streams --- src/output/output.h | 6 +++--- src/output/output_hls.cpp | 7 ++++++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/output/output.h b/src/output/output.h index 0969da7b..be875da4 100644 --- a/src/output/output.h +++ b/src/output/output.h @@ -75,9 +75,6 @@ namespace Mist { virtual void onFail(); virtual void requestHandler(); private://these *should* not be messed with in child classes. - inline bool keepGoing(){ - return config->is_active && myConn; - } std::map currKeyOpen; void loadPageForKey(long unsigned int trackId, long long int keyNum); int pageNumForKey(long unsigned int trackId, long long int keyNum); @@ -119,6 +116,9 @@ namespace Mist { void waitForStreamPushReady(); bool pushIsOngoing; void bufferLivePacket(const DTSC::Packet & packet); + inline bool keepGoing(){ + return config->is_active && myConn; + } }; } diff --git a/src/output/output_hls.cpp b/src/output/output_hls.cpp index 6f672e01..6fc3125b 100644 --- a/src/output/output_hls.cpp +++ b/src/output/output_hls.cpp @@ -175,8 +175,13 @@ namespace Mist { } initialize(); + + if (!keepGoing()){ + return; + } + if (H.url.find(".m3u") == std::string::npos){ - std::string tmpStr = H.getUrl().substr(5+streamName.size()); + std::string tmpStr = H.getUrl().substr(5 + streamName.size()); long long unsigned int from; if (sscanf(tmpStr.c_str(), "/%u_%u/%llu_%llu.ts", &vidTrack, &audTrack, &from, &until) != 4){ if (sscanf(tmpStr.c_str(), "/%u/%llu_%llu.ts", &vidTrack, &from, &until) != 3){