From 875e8ef31721f07b7f70a37b24918585fac571a7 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Tue, 5 Aug 2014 22:59:17 +0200 Subject: [PATCH] Fix for HLS URLs when only one track is available. --- src/controller/controller_streams.cpp | 4 ++-- src/output/output_hls.cpp | 26 ++++++++++++++++---------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/src/controller/controller_streams.cpp b/src/controller/controller_streams.cpp index 6716fb6a..fe325e21 100644 --- a/src/controller/controller_streams.cpp +++ b/src/controller/controller_streams.cpp @@ -52,11 +52,11 @@ namespace Controller { } return; } - if (URL.substr(0, 4) == "push"){ + if (URL.substr(0, 1) != "/"){ //push-style stream if (hasViewers(name)){ data["meta"].null(); - IPC::sharedPage streamIndex(name,0,false,false); + IPC::sharedPage streamIndex(name,8 * 1024 * 1024,false,false); if (!streamIndex.mapped){ return; } diff --git a/src/output/output_hls.cpp b/src/output/output_hls.cpp index f091dbdb..13cec671 100644 --- a/src/output/output_hls.cpp +++ b/src/output/output_hls.cpp @@ -221,17 +221,23 @@ namespace Mist { std::string fmtStr = "/hls/" + streamName + "/%u_%u/%llu_%llu.ts"; long long unsigned int from; if (sscanf(tmpStr.c_str(), fmtStr.c_str(), &vidTrack, &audTrack, &from, &until) != 4){ - WARN_MSG("Could not parse URL: %s", HTTP_R.getUrl().c_str()); - HTTP_S.Clean(); - HTTP_S.SetBody("The HLS URL wasn't understood - what did you want, exactly?\n"); - myConn.SendNow(HTTP_S.BuildResponse("404", "URL mismatch")); - HTTP_R.Clean(); //clean for any possible next requests - continue; + fmtStr = "/hls/" + streamName + "/%u/%llu_%llu.ts"; + if (sscanf(tmpStr.c_str(), fmtStr.c_str(), &vidTrack, &from, &until) != 3){ + WARN_MSG("Could not parse URL: %s", HTTP_R.getUrl().c_str()); + HTTP_S.Clean(); + HTTP_S.SetBody("The HLS URL wasn't understood - what did you want, exactly?\n"); + myConn.SendNow(HTTP_S.BuildResponse("404", "URL mismatch")); + HTTP_R.Clean(); //clean for any possible next requests + continue; + }else{ + selectedTracks.clear(); + selectedTracks.insert(vidTrack); + } + }else{ + selectedTracks.clear(); + selectedTracks.insert(vidTrack); + selectedTracks.insert(audTrack); } - DEBUG_MSG(DLVL_DEVEL, "Vid %u, Aud %u, From %llu, Until %llu", vidTrack, audTrack, from, until); - selectedTracks.clear(); - selectedTracks.insert(vidTrack); - selectedTracks.insert(audTrack); if (myMeta.live){ /// \todo Detection of out-of-range parts.