TS base class can now repeat headers every X millis instead of at hardcoded interval
This commit is contained in:
parent
5dfebb5b26
commit
1a4c62e763
5 changed files with 17 additions and 9 deletions
|
@ -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);
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
#include <unistd.h>
|
||||
|
||||
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"){
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 ++;
|
||||
|
|
|
@ -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
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue