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