RTPTcpReceiver.h
1.58 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#ifndef _RTP_TCP_RECEIVER_H_
#define _RTP_TCP_RECEIVER_H_
#include "demuxer.h"
#include "buffer.h"
#include "rtpsession.h"
#include "rtptcptransmitter.h"
#include "rtpipv4address.h"
#include "rtptcpaddress.h"
#include "rtpsessionparams.h"
#include "rtperrors.h"
#include "rtpsourcedata.h"
#include "rtpsocketutil.h"
#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <string>
#include <queue>
#include <atomic>
#include <thread>
#include <mutex>
#include "RTPReceiver.h"
using namespace jrtplib;
using namespace std;
class TcpRTPSession;
class MyTCPTransmitter;
class RTPTcpReceiver:public RTPReceiver
{
public:
RTPTcpReceiver();
~RTPTcpReceiver();
virtual bool Open(string channel_id);
virtual bool virtual bool IsOpened() ;() virtual bool IsOpened() ;
virtual void Close() ;
virtual bool RequestStream();
public:
int OnRtpRecv();
int OnRtpRecv2();
bool ReConnect();
int ListenFinish();
bool isClosing();
private:
int initSession(int localPort);
void close_task();
private:
std::atomic_bool m_bOpened;
std::atomic_bool m_bAccepted;
std::atomic_bool m_bClosing;
int64_t m_idleCount;
int64_t m_noDataCount;//线程计数,用于打开流成功但是实际没流过来
std::thread m_rtpThread; // RTP接收线程
SocketType m_nListener;
RTPSession* m_rtpSessionPtr; // RTP会话
RTPSessionParams* m_pSessparams;
MyTCPTransmitter* m_pTrans;
std::thread m_listenFinishThread; // RTP接收线程
std::atomic_bool m_bNoData{false};
};
#endif // _RTP_TCP_RECEIVER_H_