mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
降低TCP RTP 2字节头被误判为EHOME头的风险 (#2502)
当TCP RTP包大小为256字节时,可能触发RtpSplitter::onSearchPacketTail误判为EHOME格式。 这个修改一旦检测到数据不是EHOME格式,则后续不再进行尝试,以减小误判的风险。
This commit is contained in:
parent
032a2ac91d
commit
18dbbc8d19
@ -46,6 +46,7 @@ const char *RtpSplitter::onSearchPacketTail(const char *data, size_t len) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if ( _is_ehome ) {
|
||||
if (isEhome(data, len)) {
|
||||
//是ehome协议
|
||||
if (len < kEHOME_OFFSET + 4) {
|
||||
@ -58,6 +59,8 @@ 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;
|
||||
}
|
||||
|
||||
if ( _is_rtsp_interleaved ) {
|
||||
if (data[0] == '$') {
|
||||
|
@ -35,7 +35,7 @@ protected:
|
||||
const char *onSearchPacketTail_l(const char *data, size_t len);
|
||||
|
||||
private:
|
||||
bool _is_ehome = false;
|
||||
bool _is_ehome = true;
|
||||
bool _is_rtsp_interleaved = true;
|
||||
size_t _offset = 0;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user