From 4a9c137aef14703d0fdc2630cb286afe9de029b9 Mon Sep 17 00:00:00 2001 From: Thulinma Date: Thu, 18 Jul 2013 16:44:36 +0200 Subject: [PATCH] Fixed live HLS not continuing after buffer size. --- src/connectors/conn_http_live.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/connectors/conn_http_live.cpp b/src/connectors/conn_http_live.cpp index f2e2729b..0c8a1a57 100644 --- a/src/connectors/conn_http_live.cpp +++ b/src/connectors/conn_http_live.cpp @@ -28,7 +28,7 @@ namespace Connector_HTTP { ///\brief Builds an index file for HTTP Live streaming. ///\param metadata The current metadata, used to generate the index. ///\return The index file for HTTP Live Streaming. - std::string liveIndex(JSON::Value & metadata){ + std::string liveIndex(JSON::Value & metadata, bool isLive){ std::stringstream result; if (metadata.isMember("tracks")){ result << "#EXTM3U\r\n"; @@ -80,7 +80,9 @@ namespace Connector_HTTP { result << "#EXTINF:" << (((*ai)["dur"].asInt() + 500) / 1000) << ", no desc\r\n" << starttime << "_" << (*ai)["dur"].asInt() + starttime << ".ts\r\n"; } - result << "#EXT-X-ENDLIST"; + if ( !isLive){ + result << "#EXT-X-ENDLIST\r\n"; + } } #if DEBUG >= 8 std::cerr << "Sending this index:" << std::endl << Result.str() << std::endl; @@ -207,7 +209,6 @@ namespace Connector_HTTP { sstream << "s " << Segment << "\n"; sstream << "p " << frameCount << "\n"; ss.SendNow(sstream.str().c_str()); - fprintf(stderr,"Sending %s to player\n", sstream.str().c_str()); }else{ std::string request = HTTP_R.url.substr(HTTP_R.url.find("/", 5) + 1); if (HTTP_R.url.find(".m3u8") != std::string::npos){ @@ -220,10 +221,10 @@ namespace Connector_HTTP { HTTP_S.SetHeader("Cache-Control", "no-cache"); std::string manifest; if (request.find("/") == std::string::npos){ - manifest = liveIndex(Strm.metadata); + manifest = liveIndex(Strm.metadata, Strm.metadata.isMember("live")); }else{ int selectId = atoi(request.substr(0,request.find("/")).c_str()); - manifest = liveIndex(Strm.getTrackById(selectId)); + manifest = liveIndex(Strm.getTrackById(selectId), Strm.metadata.isMember("live")); } HTTP_S.SetBody(manifest); conn.SendNow(HTTP_S.BuildResponse("200", "OK"));