diff --git a/src/output/output_hls.cpp b/src/output/output_hls.cpp index 672ae528..e75a9e2a 100644 --- a/src/output/output_hls.cpp +++ b/src/output/output_hls.cpp @@ -247,6 +247,14 @@ namespace Mist { void OutHLS::onHTTP(){ AppleCompat = (H.GetHeader("User-Agent").find("Apple") != std::string::npos); + VLCworkaround = false; + if (H.GetHeader("User-Agent").substr(0, 3) == "VLC"){ + std::string vlcver = H.GetHeader("User-Agent").substr(4); + if (vlcver[0] == '0' || vlcver[0] == '1' || (vlcver[0] == '2' && vlcver[2] < '2')){ + DEBUG_MSG(DLVL_INFO, "Enabling VLC version < 2.2.0 bug workaround."); + VLCworkaround = true; + } + } initialize(); if (H.url.find(".m3u") == std::string::npos){ std::string tmpStr = H.getUrl().substr(5+streamName.size()); @@ -299,7 +307,7 @@ namespace Mist { lastVid = from * 90; H.SetHeader("Content-Type", "video/mp2t"); - H.StartResponse(H, myConn); + H.StartResponse(H, myConn, VLCworkaround); PacketNumber = 0; parseData = true; wantRequest = false; diff --git a/src/output/output_hls.h b/src/output/output_hls.h index b28bef09..8476a4ea 100644 --- a/src/output/output_hls.h +++ b/src/output/output_hls.h @@ -26,6 +26,7 @@ namespace Mist { char AudioCounter; MP4::AVCC avccbox; bool AppleCompat; + bool VLCworkaround; long long unsigned int lastVid; long long unsigned int until; unsigned int vidTrack; diff --git a/src/output/output_http.cpp b/src/output/output_http.cpp index 1d175a7a..d90feae6 100644 --- a/src/output/output_http.cpp +++ b/src/output/output_http.cpp @@ -214,7 +214,9 @@ namespace Mist { } selectDefaultTracks(); onHTTP(); - H.Clean(); + if (!H.bufferChunks){ + H.Clean(); + } } }