diff --git a/src/output/output_hls.cpp b/src/output/output_hls.cpp index edc48355..6f672e01 100644 --- a/src/output/output_hls.cpp +++ b/src/output/output_hls.cpp @@ -237,7 +237,6 @@ namespace Mist { wantRequest = false; seek(from); ts_from = from; - lastVid = from * 90; } else { initialize(); std::string request = H.url.substr(H.url.find("/", 5) + 1); diff --git a/src/output/output_httpts.cpp b/src/output/output_httpts.cpp index 90d94b6f..c65b076f 100644 --- a/src/output/output_httpts.cpp +++ b/src/output/output_httpts.cpp @@ -5,7 +5,9 @@ #include namespace Mist { - OutHTTPTS::OutHTTPTS(Socket::Connection & conn) : TSOutput(conn) {} + OutHTTPTS::OutHTTPTS(Socket::Connection & conn) : TSOutput(conn){ + sendRepeatingHeaders = 500;//PAT/PMT every 500ms (DVB spec) + } OutHTTPTS::~OutHTTPTS() {} @@ -20,7 +22,7 @@ namespace Mist { capa["codecs"][0u][1u].append("AAC"); capa["codecs"][0u][1u].append("MP3"); capa["methods"][0u]["handler"] = "http"; - capa["methods"][0u]["type"] = "html5/video/mp2t"; + capa["methods"][0u]["type"] = "html5/video/mpeg"; capa["methods"][0u]["priority"] = 1ll; } @@ -30,6 +32,9 @@ namespace Mist { H.clearHeader("Range"); H.clearHeader("Icy-MetaData"); H.clearHeader("User-Agent"); + H.clearHeader("Host"); + H.clearHeader("Accept-Ranges"); + H.clearHeader("transferMode.dlna.org"); H.SetHeader("Content-Type", "video/mpeg"); H.setCORSHeaders(); if(method == "OPTIONS" || method == "HEAD"){ diff --git a/src/output/output_ts.cpp b/src/output/output_ts.cpp index 8afae33a..6124c1b2 100644 --- a/src/output/output_ts.cpp +++ b/src/output/output_ts.cpp @@ -4,6 +4,7 @@ namespace Mist { OutTS::OutTS(Socket::Connection & conn) : TSOutput(conn){ + sendRepeatingHeaders = 500;//PAT/PMT every 500ms (DVB spec) streamName = config->getString("streamname"); parseData = true; wantRequest = false; diff --git a/src/output/output_ts_base.cpp b/src/output/output_ts_base.cpp index c1669963..c05342e4 100644 --- a/src/output/output_ts_base.cpp +++ b/src/output/output_ts_base.cpp @@ -6,20 +6,23 @@ namespace Mist { haveAvcc = false; ts_from = 0; setBlocking(true); - sendRepeatingHeaders = false; + sendRepeatingHeaders = 0; appleCompat=false; + lastHeaderTime = 0; } void TSOutput::fillPacket(char const * data, size_t dataLen, bool & firstPack, bool video, bool keyframe, uint32_t pkgPid, int & contPkg){ do { if (!packData.getBytesFree()){ - if ( (sendRepeatingHeaders && packCounter % 42 == 0) || !packCounter){ + if ( (sendRepeatingHeaders && thisPacket.getTime() - lastHeaderTime > sendRepeatingHeaders) || !packCounter){ + lastHeaderTime = thisPacket.getTime(); TS::Packet tmpPack; tmpPack.FromPointer(TS::PAT); tmpPack.setContinuityCounter(++contPAT); sendTS(tmpPack.checkAndGetBuffer()); sendTS(TS::createPMT(selectedTracks, myMeta, ++contPMT)); - packCounter += 2; + sendTS(TS::createSDT(streamName, ++contSDT)); + packCounter += 3; } sendTS(packData.checkAndGetBuffer()); packCounter ++; diff --git a/src/output/output_ts_base.h b/src/output/output_ts_base.h index c3f8548f..37e3a4eb 100644 --- a/src/output/output_ts_base.h +++ b/src/output/output_ts_base.h @@ -28,8 +28,8 @@ namespace Mist { bool haveAvcc; MP4::AVCC avccbox; bool appleCompat; - bool sendRepeatingHeaders; - long long unsigned int ts_from; - long long unsigned int lastVid; + uint64_t sendRepeatingHeaders; ///< Amount of ms between PAT/PMT. Zero means do not repeat. + uint64_t lastHeaderTime; ///< Timestamp last PAT/PMT were sent. + uint64_t ts_from; ///< Starting time to subtract from timestamps }; }