Commit e063cb3a by xiongziliang

兼容一些不规范的rtsp流

parent 0626f9a2
...@@ -10,10 +10,29 @@ ...@@ -10,10 +10,29 @@
#include <cstdlib> #include <cstdlib>
#include "RtspSplitter.h" #include "RtspSplitter.h"
#include "Util/logger.h"
#include "Util/util.h"
namespace mediakit{ namespace mediakit{
const char *RtspSplitter::onSearchPacketTail(const char *data, int len) { 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] != '$'){ if(!_enableRecvRtp || data[0] != '$'){
//这是rtsp包 //这是rtsp包
_isRtpPacket = false; _isRtpPacket = false;
......
...@@ -48,6 +48,7 @@ protected: ...@@ -48,6 +48,7 @@ protected:
virtual int64_t getContentLength(Parser &parser); virtual int64_t getContentLength(Parser &parser);
protected: protected:
const char *onSearchPacketTail(const char *data,int len) override ; 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; int64_t onRecvHeader(const char *data,uint64_t len) override;
void onRecvContent(const char *data,uint64_t len) override; void onRecvContent(const char *data,uint64_t len) override;
private: private:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论