Added live syncing code to RTSP output
This commit is contained in:
parent
92130699b1
commit
f48b2f2877
2 changed files with 18 additions and 2 deletions
|
@ -18,6 +18,7 @@ namespace Mist {
|
||||||
minSkipAhead = 0;
|
minSkipAhead = 0;
|
||||||
expectTCP = false;
|
expectTCP = false;
|
||||||
isPushing = false;
|
isPushing = false;
|
||||||
|
lastTimeSync = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Function used to send RTP packets over UDP
|
/// Function used to send RTP packets over UDP
|
||||||
|
@ -81,8 +82,8 @@ namespace Mist {
|
||||||
char * dataPointer = 0;
|
char * dataPointer = 0;
|
||||||
unsigned int dataLen = 0;
|
unsigned int dataLen = 0;
|
||||||
thisPacket.getString("data", dataPointer, dataLen);
|
thisPacket.getString("data", dataPointer, dataLen);
|
||||||
unsigned int tid = thisPacket.getTrackId();
|
uint32_t tid = thisPacket.getTrackId();
|
||||||
unsigned int timestamp = thisPacket.getTime();
|
uint64_t timestamp = thisPacket.getTime();
|
||||||
|
|
||||||
//if we're past the pausing point, seek to it, and pause immediately
|
//if we're past the pausing point, seek to it, and pause immediately
|
||||||
if (pausepoint && timestamp > pausepoint){
|
if (pausepoint && timestamp > pausepoint){
|
||||||
|
@ -91,6 +92,20 @@ namespace Mist {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (myMeta.live && lastTimeSync + 666 < timestamp){
|
||||||
|
lastTimeSync = timestamp;
|
||||||
|
updateMeta();
|
||||||
|
DTSC::Track & mainTrk = myMeta.tracks[getMainSelectedTrack()];
|
||||||
|
// The extra 1000ms here is for the metadata sync delay.
|
||||||
|
// It can be removed once we get rid of that.
|
||||||
|
if (timestamp + 1000 + needsLookAhead < mainTrk.keys.rbegin()->getTime() && mainTrk.lastms - mainTrk.keys.rbegin()->getTime() > needsLookAhead){
|
||||||
|
INFO_MSG("Skipping forward %llums (%llu ms LA)", mainTrk.keys.rbegin()->getTime() - thisPacket.getTime(), needsLookAhead);
|
||||||
|
seek(mainTrk.keys.rbegin()->getTime());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void * socket = 0;
|
void * socket = 0;
|
||||||
void (*callBack)(void *, char *, unsigned int, unsigned int) = 0;
|
void (*callBack)(void *, char *, unsigned int, unsigned int) = 0;
|
||||||
|
|
||||||
|
|
|
@ -163,6 +163,7 @@ namespace Mist {
|
||||||
unsigned int pausepoint;///< Position to pause at, when reached
|
unsigned int pausepoint;///< Position to pause at, when reached
|
||||||
HTTP::Parser HTTP_R, HTTP_S;
|
HTTP::Parser HTTP_R, HTTP_S;
|
||||||
std::string source;
|
std::string source;
|
||||||
|
uint64_t lastTimeSync;
|
||||||
bool expectTCP;
|
bool expectTCP;
|
||||||
bool handleTCP();
|
bool handleTCP();
|
||||||
void handleUDP();
|
void handleUDP();
|
||||||
|
|
Loading…
Add table
Reference in a new issue