From aad98be5ef7afd0b88ad0af740be500d551b529d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E4=BC=A0=E5=B3=B0?= <59160162+zhang-chuanfeng@users.noreply.github.com> Date: Wed, 17 Jul 2024 11:40:10 +0800 Subject: [PATCH] =?UTF-8?q?ehome=E5=8D=8F=E8=AE=AE=E6=8E=A8=E6=B5=81?= =?UTF-8?q?=E8=8A=B1=E5=B1=8F=E9=97=AE=E9=A2=98=20(#3720)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://github.com/ZLMediaKit/ZLMediaKit/issues/3710 当前修改方式 只检测一次 由于第一个数据是256字节需要检测两次 ;现在修改方式是检测3次, 如果失败就不是ehome。后续不需要检测 --- src/Rtp/RtpSplitter.cpp | 6 +++--- src/Rtp/RtpSplitter.h | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Rtp/RtpSplitter.cpp b/src/Rtp/RtpSplitter.cpp index 5a15c923..bdf4e960 100644 --- a/src/Rtp/RtpSplitter.cpp +++ b/src/Rtp/RtpSplitter.cpp @@ -46,7 +46,7 @@ const char *RtpSplitter::onSearchPacketTail(const char *data, size_t len) { return nullptr; } - if ( _is_ehome ) { + if (_check_ehome_count) { if (isEhome(data, len)) { //是ehome协议 if (len < kEHOME_OFFSET + 4) { @@ -59,7 +59,7 @@ const char *RtpSplitter::onSearchPacketTail(const char *data, size_t len) { //忽略ehome私有头 return onSearchPacketTail_l(data + kEHOME_OFFSET + 2, len - kEHOME_OFFSET - 2); } - _is_ehome = false; + _check_ehome_count--; } if ( _is_rtsp_interleaved ) { @@ -70,7 +70,7 @@ const char *RtpSplitter::onSearchPacketTail(const char *data, size_t len) { } _is_rtsp_interleaved = false; } - + //两个字节的rtp头 _offset = 2; return onSearchPacketTail_l(data, len); diff --git a/src/Rtp/RtpSplitter.h b/src/Rtp/RtpSplitter.h index 216f3021..c6b85257 100644 --- a/src/Rtp/RtpSplitter.h +++ b/src/Rtp/RtpSplitter.h @@ -31,7 +31,8 @@ protected: const char *onSearchPacketTail_l(const char *data, size_t len); private: - bool _is_ehome = true; + bool _is_ehome = false; + int _check_ehome_count = 3; bool _is_rtsp_interleaved = true; size_t _offset = 0; };