#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 #include #include #include #include #include #include #include #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 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_