mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-29 14:45:55 +08:00
18dbbc8d19
当TCP RTP包大小为256字节时,可能触发RtpSplitter::onSearchPacketTail误判为EHOME格式。 这个修改一旦检测到数据不是EHOME格式,则后续不再进行尝试,以减小误判的风险。
46 lines
1.3 KiB
C++
46 lines
1.3 KiB
C++
/*
|
|
* Copyright (c) 2016 The ZLMediaKit project authors. All Rights Reserved.
|
|
*
|
|
* This file is part of ZLMediaKit(https://github.com/xia-chu/ZLMediaKit).
|
|
*
|
|
* Use of this source code is governed by MIT license that can be found in the
|
|
* LICENSE file in the root of the source tree. All contributing project authors
|
|
* may be found in the AUTHORS file in the root of the source tree.
|
|
*/
|
|
|
|
#ifndef ZLMEDIAKIT_RTPSPLITTER_H
|
|
#define ZLMEDIAKIT_RTPSPLITTER_H
|
|
|
|
#if defined(ENABLE_RTPPROXY)
|
|
#include "Http/HttpRequestSplitter.h"
|
|
|
|
namespace mediakit{
|
|
|
|
class RtpSplitter : public HttpRequestSplitter{
|
|
public:
|
|
RtpSplitter() = default;
|
|
~RtpSplitter() override = default;
|
|
|
|
protected:
|
|
/**
|
|
* 收到rtp包回调
|
|
* @param data RTP包数据指针
|
|
* @param len RTP包数据长度
|
|
*/
|
|
virtual void onRtpPacket(const char *data, size_t len) = 0;
|
|
|
|
protected:
|
|
ssize_t onRecvHeader(const char *data, size_t len) override;
|
|
const char *onSearchPacketTail(const char *data, size_t len) override;
|
|
const char *onSearchPacketTail_l(const char *data, size_t len);
|
|
|
|
private:
|
|
bool _is_ehome = true;
|
|
bool _is_rtsp_interleaved = true;
|
|
size_t _offset = 0;
|
|
};
|
|
|
|
}//namespace mediakit
|
|
#endif//defined(ENABLE_RTPPROXY)
|
|
#endif //ZLMEDIAKIT_RTPSPLITTER_H
|