ps rtp推流支持4个字节的头

This commit is contained in:
xiongziliang 2020-08-15 09:48:27 +08:00
parent d986b1d36c
commit 62da32477e
2 changed files with 17 additions and 9 deletions

View File

@ -12,13 +12,20 @@
#include "RtpSplitter.h"
namespace mediakit{
RtpSplitter::RtpSplitter() {
}
RtpSplitter::RtpSplitter() {}
RtpSplitter::~RtpSplitter() {
}
RtpSplitter::~RtpSplitter() {}
const char *RtpSplitter::onSearchPacketTail(const char *data, int len) {
if (data[0] == '$') {
//可能是4个字节的rtp头
return onSearchPacketTail_l(data + 2, len - 2);
}
//两个字节的rtp头
return onSearchPacketTail_l(data, len);
}
const char *RtpSplitter::onSearchPacketTail_l(const char *data, int len) {
//这是rtp包
if (len < 2) {
//数据不够

View File

@ -20,15 +20,16 @@ class RtpSplitter : public HttpRequestSplitter{
public:
RtpSplitter();
virtual ~RtpSplitter();
protected:
/**
* rtp包回调
* @param data
* @param len
*/
virtual void onRtpPacket(const char *data,uint64_t len) = 0;
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;
};