mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
兼容一些不规范的rtsp流
This commit is contained in:
parent
0626f9a2bf
commit
e063cb3a00
@ -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;
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user