ehome协议推流花屏问题 (#3720)

https://github.com/ZLMediaKit/ZLMediaKit/issues/3710

当前修改方式 只检测一次  由于第一个数据是256字节需要检测两次 ;现在修改方式是检测3次, 如果失败就不是ehome。后续不需要检测
This commit is contained in:
张传峰 2024-07-17 11:40:10 +08:00 committed by GitHub
parent d735aa1797
commit aad98be5ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View File

@ -46,7 +46,7 @@ const char *RtpSplitter::onSearchPacketTail(const char *data, size_t len) {
return nullptr; return nullptr;
} }
if ( _is_ehome ) { if (_check_ehome_count) {
if (isEhome(data, len)) { if (isEhome(data, len)) {
//是ehome协议 //是ehome协议
if (len < kEHOME_OFFSET + 4) { if (len < kEHOME_OFFSET + 4) {
@ -59,7 +59,7 @@ const char *RtpSplitter::onSearchPacketTail(const char *data, size_t len) {
//忽略ehome私有头 //忽略ehome私有头
return onSearchPacketTail_l(data + kEHOME_OFFSET + 2, len - kEHOME_OFFSET - 2); return onSearchPacketTail_l(data + kEHOME_OFFSET + 2, len - kEHOME_OFFSET - 2);
} }
_is_ehome = false; _check_ehome_count--;
} }
if ( _is_rtsp_interleaved ) { if ( _is_rtsp_interleaved ) {
@ -70,7 +70,7 @@ const char *RtpSplitter::onSearchPacketTail(const char *data, size_t len) {
} }
_is_rtsp_interleaved = false; _is_rtsp_interleaved = false;
} }
//两个字节的rtp头 //两个字节的rtp头
_offset = 2; _offset = 2;
return onSearchPacketTail_l(data, len); return onSearchPacketTail_l(data, len);

View File

@ -31,7 +31,8 @@ protected:
const char *onSearchPacketTail_l(const char *data, size_t len); const char *onSearchPacketTail_l(const char *data, size_t len);
private: private:
bool _is_ehome = true; bool _is_ehome = false;
int _check_ehome_count = 3;
bool _is_rtsp_interleaved = true; bool _is_rtsp_interleaved = true;
size_t _offset = 0; size_t _offset = 0;
}; };