RTPReceiver2.h
809 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef _RTP_RECEIVER_H_
#define _RTP_RECEIVER_H_
#include <stdint.h>
#include <atomic>
#include <thread>
using namespace std;
class RTPReceiver2{
public:
RTPReceiver2();
virtual ~RTPReceiver2();
int init(const char* ip, uint16_t port, bool isUdp);
void RequestStreamFailed();
int allocRtpPort();
private:
int startUdpServer(const char* ip, uint16_t port);
int startTcpServer(const char* ip, uint16_t port);
void parseTcpData(char* recvBuf, int recvBufSize);
public:
uint8_t* mRecvCache {nullptr};
uint64_t mRecvCacheSize {0};
uint8_t* mRecvRtpBuffer {nullptr}; // 从mRecvCache提取出来的rtp字节流
int16_t mRecvRtpBufferSize {0};// 从mRecvCache提取出来的rtp字节流总长度 (rtpHeader+rtpBody)
bool m_bRtpExit {false};
};
#endif // _RTP_RECEIVER_H_