From ce04a7279c28eae9aebf67d67c2c9f6170d3db04 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Mon, 5 Apr 2021 00:12:46 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webrtc/WebRtcTransport.cpp | 4 ++-- webrtc/WebRtcTransport.h | 16 +++++++++++----- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/webrtc/WebRtcTransport.cpp b/webrtc/WebRtcTransport.cpp index 2dbbef3b..bf79e477 100644 --- a/webrtc/WebRtcTransport.cpp +++ b/webrtc/WebRtcTransport.cpp @@ -102,7 +102,7 @@ void WebRtcTransport::setRemoteDtlsFingerprint(const RtcSession &remote){ _dtls_transport->SetRemoteFingerprint(remote_fingerprint); } -void WebRtcTransport::onCheckSdp(SdpType type, RtcSession &sdp) const{ +void WebRtcTransport::onCheckSdp(SdpType type, RtcSession &sdp){ for (auto &m : sdp.media) { if (m.type != TrackApplication && !m.rtcp_mux) { throw std::invalid_argument("只支持rtcp-mux模式"); @@ -292,7 +292,7 @@ void WebRtcTransportImp::onStartWebRTC() { } } -void WebRtcTransportImp::onCheckSdp(SdpType type, RtcSession &sdp) const{ +void WebRtcTransportImp::onCheckSdp(SdpType type, RtcSession &sdp){ WebRtcTransport::onCheckSdp(type, sdp); if (type != SdpType::answer || !canSendRtp()) { return; diff --git a/webrtc/WebRtcTransport.h b/webrtc/WebRtcTransport.h index 28086a01..6ba2cb4e 100644 --- a/webrtc/WebRtcTransport.h +++ b/webrtc/WebRtcTransport.h @@ -79,7 +79,7 @@ protected: protected: virtual void onStartWebRTC() = 0; virtual void onRtcConfigure(RtcConfigure &configure) const {} - virtual void onCheckSdp(SdpType type, RtcSession &sdp) const; + virtual void onCheckSdp(SdpType type, RtcSession &sdp); virtual void onSendSockData(const char *buf, size_t len, struct sockaddr_in *dst, bool flush = true) = 0; virtual void onRtp(const char *buf, size_t len) = 0; @@ -125,7 +125,7 @@ public: protected: void onStartWebRTC() override; void onSendSockData(const char *buf, size_t len, struct sockaddr_in *dst, bool flush = true) override; - void onCheckSdp(SdpType type, RtcSession &sdp) const override; + void onCheckSdp(SdpType type, RtcSession &sdp) override; void onRtcConfigure(RtcConfigure &configure) const override; void onRtp(const char *buf, size_t len) override; @@ -153,14 +153,20 @@ private: void onBeforeSortedRtp(const RtpPayloadInfo &info,const RtpPacket::Ptr &rtp); private: - uint32_t _recv_video_ssrc; - mutable uint8_t _send_rtp_pt[2] = {0, 0}; + //pli rtcp计时器 Ticker _pli_ticker; + //rtc rtp推流的视频ssrc + uint32_t _recv_video_ssrc; + //记录协商的rtp的pt类型 + uint8_t _send_rtp_pt[2] = {0, 0}; + //复合udp端口,接收一切rtp与rtcp Socket::Ptr _socket; - RtcSession _answer_sdp; + //推流或播放的rtsp源 RtspMediaSource::Ptr _src; RtspMediaSource::RingType::RingReader::Ptr _reader; + //根据rtp的pt获取相关信息 unordered_map _rtp_info_pt; + //根据推流端rtp的ssrc获取相关信息 unordered_map _rtp_info_ssrc; };