From b6e4e0243eab426a5700713126bee02fc3d74982 Mon Sep 17 00:00:00 2001 From: Erik Zandvliet Date: Mon, 6 Oct 2014 14:54:19 +0200 Subject: [PATCH] Fixed HLS (some more) --- src/output/output_hls.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/output/output_hls.cpp b/src/output/output_hls.cpp index 0e0868e9..4d1f39ee 100644 --- a/src/output/output_hls.cpp +++ b/src/output/output_hls.cpp @@ -57,7 +57,11 @@ namespace Mist { for (std::deque::iterator it = myMeta.tracks[tid].fragments.begin(); it != myMeta.tracks[tid].fragments.end(); it++){ long long int starttime = myMeta.tracks[tid].getKey(it->getNumber()).getTime(); std::stringstream line; - line << "#EXTINF:" << ((it->getDuration() + 500) / 1000) << ", no desc\r\n" << starttime << "_" << it->getDuration() + starttime << ".ts\r\n"; + long long duration = it->getDuration(); + if (duration < 0){ + duration = myMeta.tracks[tid].lastms - starttime; + } + line << "#EXTINF:" << ((duration + 500) / 1000) << ", no desc\r\n" << starttime << "_" << duration + starttime << ".ts\r\n"; lines.push_back(line.str()); } @@ -293,6 +297,10 @@ namespace Mist { continue; } //crossdomain.xml + if (HTTP_R.url.find("hls") == std::string::npos){ + myConn.close(); + continue; + } AppleCompat = (HTTP_R.GetHeader("User-Agent").find("Apple") != std::string::npos); initialize();