兼容一些不规范的rtsp流

This commit is contained in:
xiongziliang 2020-05-25 21:54:43 +08:00
parent 0626f9a2bf
commit e063cb3a00
2 changed files with 20 additions and 0 deletions

View File

@ -10,10 +10,29 @@
#include <cstdlib>
#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;

View File

@ -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: