RTPUdpReceiver.h
1.3 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#ifndef _RTP_UDP_RECEIVER_H_
#define _RTP_UDP_RECEIVER_H_
#include "rtpudpv4transmitter.h"
#include "rtpipv4address.h"
#include "rtpsessionparams.h"
#include "rtpsession.h"
#include <queue>
#include <iostream>
#include <thread>
#include <string>
#include <mutex>
#include "RTPReceiver.h"
#define OUTTIME_RTCP 30*1000
#define PAYLOAD 99
#define PAYLOAD_PS 96
#define PAYLOAD_H264 98
#define PAYLOAD_MP4 97
#define UDP_SIZE 1400
#define MIN_PORT 10000
#define MAX_PORT 60000
#define RTP_MAX_PACKET_LEN 1450
using namespace jrtplib;
using namespace std;
class UdpRTPSession;
class RTPUdpReceiver: public RTPReceiver
{
public:
RTPUdpReceiver();
~RTPUdpReceiver();
virtual bool Open(uint16_t localPort);
virtual bool virtual bool IsOpened() ;() virtual bool IsOpened() ;
virtual void Close() ;
public:
int OnRtpRecv();
private:
std::thread* m_rtpThreadPtr; // RTP接收线程
UdpRTPSession* m_rtpSessionPtr; // RTP会话
std::atomic_bool m_bRtpExit; // 标识RTP收包线程闭
std::atomic_bool m_bOpened;
int64_t m_idleCount;
int64_t m_noDataCount;//线程计数,用于打开流成功但是实际没流过来
RTPSessionParams* m_sessparamsPtr;
RTPUDPv4TransmissionParams* m_transparamsPtr;
};
#endif // _RTP_UDP_RECEIVER_H_