mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-23 03:10:04 +08:00
ps rtp推流支持4个字节的头
This commit is contained in:
parent
d986b1d36c
commit
62da32477e
@ -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) {
|
||||
//数据不够
|
||||
|
@ -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;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user