RTPUdpReceiver.h
1.34 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 "rtpsessionparams.h"
#include "rtpudpv4transmitter.h"
#include "rtpsession.h"
#include "rtppacket.h"
#include <queue>
#include <iostream>
#include <thread>
#include <string>
#include <mutex>
#include "RTPReceiver.h"
using namespace jrtplib;
using namespace std;
class UdpRTPSession;
class RTPUdpReceiver: public RTPReceiver
{
public:
RTPUdpReceiver();
~RTPUdpReceiver();
virtual bool Open(string channel_id);
virtual bool virtual bool IsOpened() ;() virtual bool IsOpened() ;
virtual void Close() ;
virtual bool RequestStream();
public:
int OnRtpRecv();
int CheckConnecting();
private:
bool wait_times(int times);
private:
std::thread* m_rtpThreadPtr{nullptr}; // RTP接收线程
std::thread* m_connThreadPtr{nullptr}; // 判断流是否还在的线程
RTPSession* m_rtpSessionPtr{nullptr}; // RTP会话
RTPSession m_rtpSession;
std::atomic_bool m_bOpened;
int64_t m_idleCount;
int64_t m_noDataCount;//线程计数,用于打开流成功但是实际没流过来
RTPSessionParams* m_sessparamsPtr{nullptr};
RTPUDPv4TransmissionParams* m_transparamsPtr{nullptr};
string m_sip_channel_id;
std::atomic_bool m_bNoData{false};
bool m_bRecvExit{false};
};
#endif // _RTP_UDP_RECEIVER_H_