diff --git a/src/Rtsp/RtspSplitter.cpp b/src/Rtsp/RtspSplitter.cpp index caaf1054..1c97f369 100644 --- a/src/Rtsp/RtspSplitter.cpp +++ b/src/Rtsp/RtspSplitter.cpp @@ -10,10 +10,29 @@ #include #include "RtspSplitter.h" +#include "Util/logger.h" +#include "Util/util.h" namespace mediakit{ const char *RtspSplitter::onSearchPacketTail(const char *data, int len) { + auto ret = onSearchPacketTail_l(data, len); + if(ret){ + return ret; + } + + if (len > 256 * 1024) { + //rtp大于256KB + ret = (char *) memchr(data, '$', len); + if (!ret) { + WarnL << "rtp缓存溢出:" << hexdump(data, 1024); + reset(); + } + } + return ret; +} + +const char *RtspSplitter::onSearchPacketTail_l(const char *data, int len) { if(!_enableRecvRtp || data[0] != '$'){ //这是rtsp包 _isRtpPacket = false; diff --git a/src/Rtsp/RtspSplitter.h b/src/Rtsp/RtspSplitter.h index c319410c..3cd35821 100644 --- a/src/Rtsp/RtspSplitter.h +++ b/src/Rtsp/RtspSplitter.h @@ -48,6 +48,7 @@ protected: virtual int64_t getContentLength(Parser &parser); protected: const char *onSearchPacketTail(const char *data,int len) override ; + const char *onSearchPacketTail_l(const char *data,int len) ; int64_t onRecvHeader(const char *data,uint64_t len) override; void onRecvContent(const char *data,uint64_t len) override; private: