From c3231d215618fa053b0ab8a29a7c78e68167bf2b Mon Sep 17 00:00:00 2001 From: xzl <771730766@qq.com> Date: Sat, 27 May 2017 10:10:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3rtmp=E6=97=B6=E9=97=B4?= =?UTF-8?q?=E6=88=B3=E5=BC=82=E5=B8=B8=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Rtmp/Rtmp.h | 1 + src/Rtmp/RtmpProtocol.cpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) 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);