Added bootMsOffset to DTSC::Meta, RTMP now syncs on it.

This commit is contained in:
Thulinma 2018-07-04 11:30:38 +02:00
parent bd0b820577
commit 43934cf69c
5 changed files with 52 additions and 5 deletions

View file

@ -1187,6 +1187,7 @@ namespace Mist{
return false;
}
}
initialize();
return true;
}
@ -1225,6 +1226,7 @@ namespace Mist{
DTSC::Meta reMeta;
reMeta.reinit(tmpMeta);
myMeta.sourceURI = reMeta.sourceURI;
myMeta.bootMsOffset = reMeta.bootMsOffset;
}
if (liveSem){
liveSem->post();
@ -1232,6 +1234,7 @@ namespace Mist{
liveSem = 0;
}
}
nProxy.metaPages.clear();
}
}
}

View file

@ -925,6 +925,16 @@ namespace Mist {
F.toMeta(myMeta, *amf_storage, reTrack);
if (F.getDataLen() && !(F.needsInitData() && F.isInitData())){
uint64_t tagTime = next.timestamp;
if (!bootMsOffset){
if (myMeta.bootMsOffset){
bootMsOffset = myMeta.bootMsOffset;
rtmpOffset = (Util::bootMS() - tagTime) - bootMsOffset;
}else{
bootMsOffset = Util::bootMS() - tagTime;
rtmpOffset = 0;
}
}
tagTime += rtmpOffset;
uint64_t & ltt = lastTagTime[reTrack];
//Check for decreasing timestamps - this is a connection error.
//We allow wrapping around the 32 bits maximum value if the most significant 8 bits are set.
@ -949,7 +959,7 @@ namespace Mist {
ptr[i+1] = tmpchar;
}
}
thisPacket.genericFill(tagTime, F.offset(), reTrack, F.getData(), F.getDataLen(), 0, F.isKeyframe);
thisPacket.genericFill(tagTime, F.offset(), reTrack, F.getData(), F.getDataLen(), 0, F.isKeyframe, F.isKeyframe?bootMsOffset:0);
ltt = tagTime;
if (!nProxy.userClient.getData()){
char userPageName[NAME_BUFFER_SIZE];

View file

@ -15,8 +15,10 @@ namespace Mist {
void sendHeader();
bool onFinish();
protected:
uint64_t rtmpOffset;
void parseVars(std::string data);
int64_t rtmpOffset;
uint64_t lastOutTime;
int64_t bootMsOffset;
std::string app_name;
void parseChunk(Socket::Buffer & inputBuffer);
void parseAMFCommand(AMF::Object & amfData, int messageType, int streamId);