Moved HLS-specific TS output handling from output_ts_base to output_hls

This commit is contained in:
Thulinma 2016-10-24 17:35:23 +02:00
parent af96a8577d
commit f69fe8a4fb
4 changed files with 18 additions and 11 deletions

View file

@ -108,6 +108,7 @@ namespace Mist {
OutHLS::OutHLS(Socket::Connection & conn) : TSOutput(conn){
realTime = 0;
until=0xFFFFFFFFFFFFFFFFull;
}
OutHLS::~OutHLS() {}
@ -270,6 +271,19 @@ namespace Mist {
}
}
void OutHLS::sendNext(){
//First check if we need to stop.
if (thisPacket.getTime() >= until){
stop();
wantRequest = true;
parseData = false;
//Ensure alignment of contCounters for selected tracks, to prevent discontinuities.
H.Chunkify("", 0, myConn);
return;
}
//Invoke the generic TS output sendNext handler
TSOutput::sendNext();
}
void OutHLS::sendTS(const char * tsData, unsigned int len){
H.Chunkify(tsData, len, myConn);

View file

@ -8,6 +8,7 @@ namespace Mist {
~OutHLS();
static void init(Util::Config * cfg);
void sendTS(const char * tsData, unsigned int len=188);
void sendNext();
void onHTTP();
bool isReadyForPlay();
protected:
@ -18,6 +19,7 @@ namespace Mist {
int keysToSend;
unsigned int vidTrack;
unsigned int audTrack;
long long unsigned int until;
};
}

View file

@ -5,7 +5,6 @@ namespace Mist {
packCounter=0;
haveAvcc = false;
ts_from = 0;
until=0xFFFFFFFFFFFFFFFFull;
setBlocking(true);
sendRepeatingHeaders = false;
appleCompat=false;
@ -30,7 +29,7 @@ namespace Mist {
if (!dataLen){return;}
if (packData.getBytesFree() == 184){
packData.clear();
packData.clear();
packData.setPID(pkgPid);
packData.setContinuityCounter(++contPkg);
if (firstPack){
@ -68,13 +67,6 @@ namespace Mist {
char * dataPointer = 0;
unsigned int dataLen = 0;
thisPacket.getString("data", dataPointer, dataLen); //data
if (packTime >= until){ //this if should only trigger for HLS
stop();
wantRequest = true;
parseData = false;
sendTS("",0);
return;
}
//apple compatibility timestamp correction
if (appleCompat){
packTime -= ts_from;

View file

@ -14,7 +14,7 @@ namespace Mist {
public:
TSOutput(Socket::Connection & conn);
virtual ~TSOutput(){};
void sendNext();
virtual void sendNext();
virtual void sendTS(const char * tsData, unsigned int len=188){};
void fillPacket(char const * data, size_t dataLen, bool & firstPack, bool video, bool keyframe, uint32_t pkgPid, int & contPkg);
protected:
@ -29,7 +29,6 @@ namespace Mist {
bool appleCompat;
bool sendRepeatingHeaders;
long long unsigned int ts_from;
long long unsigned int until;
long long unsigned int lastVid;
};
}