Blame view

src/gb28181/RTPTcpReceiver.h 1.78 KB
372e629f   ming   gb28181支持TCP数据流
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
  #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"
  
  
  #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 TcpRTPSession;
  class MyTCPTransmitter;
  
  class RTPTcpReceiver:public RTPReceiver
  {
  public:
  	RTPTcpReceiver();
  	~RTPTcpReceiver();
  
  	bool Open(uint16_t localPort);
  	bool IsOpened();
  	void Close();
  
  public:
  	int OnRtpRecv();
92989af0   ming   更新解码器
60
61
      bool ReConnect();
      int ListenFinish();
372e629f   ming   gb28181支持TCP数据流
62
63
64
65
66
      bool RequestStream();
      bool isClosing();
  
  private:
      int initSession(int localPort);
92989af0   ming   更新解码器
67
      void close_task();
372e629f   ming   gb28181支持TCP数据流
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
  
  private:
  	
      std::atomic_bool    m_bRtpExit;					// 标识RTP收包线程闭
  
      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;
  
92989af0   ming   更新解码器
83
84
85
86
87
88
      RTPSession*	        m_rtpSessionPtr;					// RTP会话
      RTPSessionParams*   m_pSessparams;
      MyTCPTransmitter*   m_pTrans;
  
      std::thread      	m_listenFinishThread; 					// RTP接收线程
      
372e629f   ming   gb28181支持TCP数据流
89
90
91
  };
  
  #endif  // _RTP_TCP_RECEIVER_H_