From b580d6c736e496d7b375b440c73d0c8a696c1d8d Mon Sep 17 00:00:00 2001 From: xia-chu <771730766@qq.com> Date: Sat, 22 Jul 2023 20:08:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=88=A4=E6=96=AD=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E4=B8=BA=E5=A2=9E=E5=BC=BA=E5=9E=8Brtmp=E5=8D=8F?= =?UTF-8?q?=E8=AE=AE=E7=9B=B8=E5=85=B3bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 有符合整型右移7位可能为-1(而不是1) 这样将导致在处理增强型rtmp时,判断关键帧和配置帧失败 --- src/Rtmp/Rtmp.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Rtmp/Rtmp.cpp b/src/Rtmp/Rtmp.cpp index 4fa8bce3..8dd7505d 100644 --- a/src/Rtmp/Rtmp.cpp +++ b/src/Rtmp/Rtmp.cpp @@ -157,7 +157,7 @@ bool RtmpPacket::isVideoKeyFrame() const { return false; } RtmpFrameType frame_type; - if (buffer[0] >> 7 == 1) { + if (buffer[0] >> 7) { // IsExHeader == 1 frame_type = (RtmpFrameType)((buffer[0] >> 4) & 0x07); } else { @@ -176,7 +176,7 @@ bool RtmpPacket::isConfigFrame() const { if (!isVideoKeyFrame()) { return false; } - if (buffer[0] >> 7 == 1) { + if (buffer[0] >> 7) { // IsExHeader == 1 return (RtmpPacketType)(buffer[0] & 0x0f) == RtmpPacketType::PacketTypeSequenceStart; } @@ -263,7 +263,7 @@ CodecId parseVideoRtmpPacket(const uint8_t *data, size_t size, RtmpPacketInfo *i info->codec = CodecInvalid; CHECK(size > 0); - if (data[0] >> 7 == 1) { + if (data[0] >> 7) { // IsExHeader == 1 CHECK(size >= 5, "Invalid rtmp buffer size: ", size); info->is_enhanced = true;