From bf3b917f1f8cec4b50d17eafff7e2518030fee46 Mon Sep 17 00:00:00 2001 From: winlin Date: Fri, 24 Jul 2020 10:08:01 +0800 Subject: [PATCH] RTC: Rename SrsRtcOutgoingInfo to SrsRtcPlayStreamStatistic --- trunk/src/app/srs_app_rtc_conn.cpp | 18 +++++++++--------- trunk/src/app/srs_app_rtc_conn.hpp | 18 +++++++++--------- trunk/src/app/srs_app_rtc_source.cpp | 6 +++--- trunk/src/app/srs_app_rtc_source.hpp | 8 ++++---- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/trunk/src/app/srs_app_rtc_conn.cpp b/trunk/src/app/srs_app_rtc_conn.cpp index b82461c95..046484485 100644 --- a/trunk/src/app/srs_app_rtc_conn.cpp +++ b/trunk/src/app/srs_app_rtc_conn.cpp @@ -196,7 +196,7 @@ srs_error_t SrsSecurityTransport::unprotect_rtcp(const char* cipher, char* plain return srtp_->unprotect_rtcp(cipher, plaintext, nb_plaintext); } -SrsRtcOutgoingInfo::SrsRtcOutgoingInfo() +SrsRtcPlayStreamStatistic::SrsRtcPlayStreamStatistic() { #if defined(SRS_DEBUG) debug_id = 0; @@ -209,7 +209,7 @@ SrsRtcOutgoingInfo::SrsRtcOutgoingInfo() nn_padding_bytes = nn_paddings = 0; } -SrsRtcOutgoingInfo::~SrsRtcOutgoingInfo() +SrsRtcPlayStreamStatistic::~SrsRtcPlayStreamStatistic() { } @@ -425,7 +425,7 @@ srs_error_t SrsRtcPlayStream::cycle() } } -srs_error_t SrsRtcPlayStream::send_packets(SrsRtcStream* source, const vector& pkts, SrsRtcOutgoingInfo& info) +srs_error_t SrsRtcPlayStream::send_packets(SrsRtcStream* source, const vector& pkts, SrsRtcPlayStreamStatistic& info) { srs_error_t err = srs_success; @@ -1555,7 +1555,7 @@ SrsRtcConnection::SrsRtcConnection(SrsRtcServer* s, SrsContextId context_id) state_ = INIT; last_stun_time = 0; - sessionStunTimeout = 0; + session_timeout = 0; disposing_ = false; twcc_id_ = 0; @@ -1757,11 +1757,11 @@ srs_error_t SrsRtcConnection::initialize(SrsRtcStream* source, SrsRequest* r, bo } // TODO: FIXME: Support reload. - sessionStunTimeout = _srs_config->get_rtc_stun_timeout(req->vhost); + session_timeout = _srs_config->get_rtc_stun_timeout(req->vhost); last_stun_time = srs_get_system_time(); srs_trace("RTC init session, DTLS(role=%s, version=%s), timeout=%dms", - cfg->dtls_role.c_str(), cfg->dtls_version.c_str(), srsu2msi(sessionStunTimeout)); + cfg->dtls_role.c_str(), cfg->dtls_version.c_str(), srsu2msi(session_timeout)); return err; } @@ -1852,7 +1852,7 @@ srs_error_t SrsRtcConnection::on_connection_established() srs_error_t err = srs_success; srs_trace("RTC %s session=%s, to=%dms connection established", (is_publisher_? "Publisher":"Subscriber"), - id().c_str(), srsu2msi(sessionStunTimeout)); + id().c_str(), srsu2msi(session_timeout)); if (is_publisher_) { if ((err = start_publish()) != srs_success) { @@ -1891,7 +1891,7 @@ srs_error_t SrsRtcConnection::start_publish() bool SrsRtcConnection::is_stun_timeout() { - return last_stun_time + sessionStunTimeout < srs_get_system_time(); + return last_stun_time + session_timeout < srs_get_system_time(); } // TODO: FIXME: We should support multiple addresses, because client may use more than one addresses. @@ -2135,7 +2135,7 @@ void SrsRtcConnection::simulate_player_drop_packet(SrsRtpHeader* h, int nn_bytes nn_simulate_player_nack_drop--; } -srs_error_t SrsRtcConnection::do_send_packets(const std::vector& pkts, SrsRtcOutgoingInfo& info) +srs_error_t SrsRtcConnection::do_send_packets(const std::vector& pkts, SrsRtcPlayStreamStatistic& info) { srs_error_t err = srs_success; diff --git a/trunk/src/app/srs_app_rtc_conn.hpp b/trunk/src/app/srs_app_rtc_conn.hpp index cb1d1c659..a7e4726af 100644 --- a/trunk/src/app/srs_app_rtc_conn.hpp +++ b/trunk/src/app/srs_app_rtc_conn.hpp @@ -88,6 +88,7 @@ enum SrsRtcConnectionStateType CLOSED = 5, }; +// The security transport, use DTLS/SRTP to protect the data. class SrsSecurityTransport : public ISrsDtlsCallback { private: @@ -127,8 +128,7 @@ private: }; // A group of RTP packets for outgoing(send to players). -// TODO: FIXME: Rename to stat for RTP packets. -class SrsRtcOutgoingInfo +class SrsRtcPlayStreamStatistic { public: #if defined(SRS_DEBUG) @@ -160,8 +160,8 @@ public: // The number of padded packet. int nn_paddings; public: - SrsRtcOutgoingInfo(); - virtual ~SrsRtcOutgoingInfo(); + SrsRtcPlayStreamStatistic(); + virtual ~SrsRtcPlayStreamStatistic(); }; // A RTC play stream, client pull and play stream from SRS. @@ -184,8 +184,8 @@ private: private: // Whether palyer started. bool is_started; - // statistic send packets. - SrsRtcOutgoingInfo info; + // The statistic for consumer to send packets to player. + SrsRtcPlayStreamStatistic info; public: SrsRtcPlayStream(SrsRtcConnection* s, SrsContextId parent_cid); virtual ~SrsRtcPlayStream(); @@ -205,7 +205,7 @@ public: public: virtual srs_error_t cycle(); private: - srs_error_t send_packets(SrsRtcStream* source, const std::vector& pkts, SrsRtcOutgoingInfo& info); + srs_error_t send_packets(SrsRtcStream* source, const std::vector& pkts, SrsRtcPlayStreamStatistic& info); public: void nack_fetch(std::vector& pkts, uint32_t ssrc, uint16_t seq); public: @@ -328,7 +328,7 @@ private: std::string peer_id_; private: // The timeout of session, keep alive by STUN ping pong. - srs_utime_t sessionStunTimeout; + srs_utime_t session_timeout; srs_utime_t last_stun_time; private: // For each RTC session, we use a specified cid for debugging logs. @@ -404,7 +404,7 @@ public: // Simulate the NACK to drop nn packets. void simulate_nack_drop(int nn); void simulate_player_drop_packet(SrsRtpHeader* h, int nn_bytes); - srs_error_t do_send_packets(const std::vector& pkts, SrsRtcOutgoingInfo& info); + srs_error_t do_send_packets(const std::vector& pkts, SrsRtcPlayStreamStatistic& info); private: srs_error_t on_binding_request(SrsStunPacket* r); // publish media capabilitiy negotiate diff --git a/trunk/src/app/srs_app_rtc_source.cpp b/trunk/src/app/srs_app_rtc_source.cpp index 9481331de..e8798b7be 100644 --- a/trunk/src/app/srs_app_rtc_source.cpp +++ b/trunk/src/app/srs_app_rtc_source.cpp @@ -1728,7 +1728,7 @@ std::string SrsRtcSendTrack::get_track_id() return track_desc_->id_; } -srs_error_t SrsRtcSendTrack::on_rtp(SrsRtpPacket2* pkt, SrsRtcOutgoingInfo& info) +srs_error_t SrsRtcSendTrack::on_rtp(SrsRtpPacket2* pkt, SrsRtcPlayStreamStatistic& info) { return srs_success; } @@ -1747,7 +1747,7 @@ SrsRtcAudioSendTrack::~SrsRtcAudioSendTrack() { } -srs_error_t SrsRtcAudioSendTrack::on_rtp(SrsRtpPacket2* pkt, SrsRtcOutgoingInfo& info) +srs_error_t SrsRtcAudioSendTrack::on_rtp(SrsRtpPacket2* pkt, SrsRtcPlayStreamStatistic& info) { srs_error_t err = srs_success; @@ -1794,7 +1794,7 @@ SrsRtcVideoSendTrack::~SrsRtcVideoSendTrack() { } -srs_error_t SrsRtcVideoSendTrack::on_rtp(SrsRtpPacket2* pkt, SrsRtcOutgoingInfo& info) +srs_error_t SrsRtcVideoSendTrack::on_rtp(SrsRtpPacket2* pkt, SrsRtcPlayStreamStatistic& info) { srs_error_t err = srs_success; diff --git a/trunk/src/app/srs_app_rtc_source.hpp b/trunk/src/app/srs_app_rtc_source.hpp index 297a7042a..0ae81a817 100644 --- a/trunk/src/app/srs_app_rtc_source.hpp +++ b/trunk/src/app/srs_app_rtc_source.hpp @@ -54,7 +54,7 @@ class SrsRtcConnection; class SrsRtpRingBuffer; class SrsRtpNackForReceiver; class SrsJsonObject; -class SrsRtcOutgoingInfo; +class SrsRtcPlayStreamStatistic; class SrsNtp { @@ -471,7 +471,7 @@ public: void set_track_status(bool active); std::string get_track_id(); public: - virtual srs_error_t on_rtp(SrsRtpPacket2* pkt, SrsRtcOutgoingInfo& info); + virtual srs_error_t on_rtp(SrsRtpPacket2* pkt, SrsRtcPlayStreamStatistic& info); virtual srs_error_t on_rtcp(SrsRtpPacket2* pkt); }; @@ -481,7 +481,7 @@ public: SrsRtcAudioSendTrack(SrsRtcConnection* session, SrsRtcTrackDescription* track_desc); virtual ~SrsRtcAudioSendTrack(); public: - virtual srs_error_t on_rtp(SrsRtpPacket2* pkt, SrsRtcOutgoingInfo& info); + virtual srs_error_t on_rtp(SrsRtpPacket2* pkt, SrsRtcPlayStreamStatistic& info); virtual srs_error_t on_rtcp(SrsRtpPacket2* pkt); }; @@ -491,7 +491,7 @@ public: SrsRtcVideoSendTrack(SrsRtcConnection* session, SrsRtcTrackDescription* track_desc); virtual ~SrsRtcVideoSendTrack(); public: - virtual srs_error_t on_rtp(SrsRtpPacket2* pkt, SrsRtcOutgoingInfo& info); + virtual srs_error_t on_rtp(SrsRtpPacket2* pkt, SrsRtcPlayStreamStatistic& info); virtual srs_error_t on_rtcp(SrsRtpPacket2* pkt); };