diff --git a/src/Rtmp/Rtmp.h b/src/Rtmp/Rtmp.h index b9e5db74..4abffdde 100644 --- a/src/Rtmp/Rtmp.h +++ b/src/Rtmp/Rtmp.h @@ -93,6 +93,7 @@ public: uint8_t typeId; uint32_t bodySize = 0; uint32_t timeStamp = 0; + bool hasAbsStamp = false; uint32_t deltaStamp = 0; uint32_t streamId; uint32_t chunkId; diff --git a/src/Rtmp/RtmpProtocol.cpp b/src/Rtmp/RtmpProtocol.cpp index 245b3918..fb497e87 100644 --- a/src/Rtmp/RtmpProtocol.cpp +++ b/src/Rtmp/RtmpProtocol.cpp @@ -487,6 +487,7 @@ void RtmpProtocol::handle_rtmp() { chunkData.chunkId = m_iNowChunkID; switch (iHeaderLen) { case 12: + chunkData.hasAbsStamp = true; chunkData.streamId = load_le32(header.streamId); case 8: chunkData.bodySize = load_be24(header.bodySize); @@ -519,7 +520,8 @@ void RtmpProtocol::handle_rtmp() { if (chunkData.strBuf.size() == chunkData.bodySize) { //frame is ready - chunkData.timeStamp = chunkData.deltaStamp + (iHeaderLen == 12 ? 0 : chunkData.timeStamp); + chunkData.timeStamp = chunkData.deltaStamp + (chunkData.hasAbsStamp ? 0 : chunkData.timeStamp); + chunkData.hasAbsStamp = false; m_iNowStreamID = chunkData.streamId; if(chunkData.bodySize){ handle_rtmpChunk(chunkData);