Commit c3231d21 by xzl

修正rtmp时间戳异常的bug

parent 9a2d54ce
......@@ -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;
......
......@@ -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);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论