1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

RTC: Rename SrsRtcOutgoingInfo to SrsRtcPlayStreamStatistic

This commit is contained in:
winlin 2020-07-24 10:08:01 +08:00
parent 0131472ae5
commit bf3b917f1f
4 changed files with 25 additions and 25 deletions

View file

@ -196,7 +196,7 @@ srs_error_t SrsSecurityTransport::unprotect_rtcp(const char* cipher, char* plain
return srtp_->unprotect_rtcp(cipher, plaintext, nb_plaintext); return srtp_->unprotect_rtcp(cipher, plaintext, nb_plaintext);
} }
SrsRtcOutgoingInfo::SrsRtcOutgoingInfo() SrsRtcPlayStreamStatistic::SrsRtcPlayStreamStatistic()
{ {
#if defined(SRS_DEBUG) #if defined(SRS_DEBUG)
debug_id = 0; debug_id = 0;
@ -209,7 +209,7 @@ SrsRtcOutgoingInfo::SrsRtcOutgoingInfo()
nn_padding_bytes = nn_paddings = 0; 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<SrsRtpPacket2*>& pkts, SrsRtcOutgoingInfo& info) srs_error_t SrsRtcPlayStream::send_packets(SrsRtcStream* source, const vector<SrsRtpPacket2*>& pkts, SrsRtcPlayStreamStatistic& info)
{ {
srs_error_t err = srs_success; srs_error_t err = srs_success;
@ -1555,7 +1555,7 @@ SrsRtcConnection::SrsRtcConnection(SrsRtcServer* s, SrsContextId context_id)
state_ = INIT; state_ = INIT;
last_stun_time = 0; last_stun_time = 0;
sessionStunTimeout = 0; session_timeout = 0;
disposing_ = false; disposing_ = false;
twcc_id_ = 0; twcc_id_ = 0;
@ -1757,11 +1757,11 @@ srs_error_t SrsRtcConnection::initialize(SrsRtcStream* source, SrsRequest* r, bo
} }
// TODO: FIXME: Support reload. // 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(); last_stun_time = srs_get_system_time();
srs_trace("RTC init session, DTLS(role=%s, version=%s), timeout=%dms", 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; return err;
} }
@ -1852,7 +1852,7 @@ srs_error_t SrsRtcConnection::on_connection_established()
srs_error_t err = srs_success; srs_error_t err = srs_success;
srs_trace("RTC %s session=%s, to=%dms connection established", (is_publisher_? "Publisher":"Subscriber"), 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 (is_publisher_) {
if ((err = start_publish()) != srs_success) { if ((err = start_publish()) != srs_success) {
@ -1891,7 +1891,7 @@ srs_error_t SrsRtcConnection::start_publish()
bool SrsRtcConnection::is_stun_timeout() 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. // 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--; nn_simulate_player_nack_drop--;
} }
srs_error_t SrsRtcConnection::do_send_packets(const std::vector<SrsRtpPacket2*>& pkts, SrsRtcOutgoingInfo& info) srs_error_t SrsRtcConnection::do_send_packets(const std::vector<SrsRtpPacket2*>& pkts, SrsRtcPlayStreamStatistic& info)
{ {
srs_error_t err = srs_success; srs_error_t err = srs_success;

View file

@ -88,6 +88,7 @@ enum SrsRtcConnectionStateType
CLOSED = 5, CLOSED = 5,
}; };
// The security transport, use DTLS/SRTP to protect the data.
class SrsSecurityTransport : public ISrsDtlsCallback class SrsSecurityTransport : public ISrsDtlsCallback
{ {
private: private:
@ -127,8 +128,7 @@ private:
}; };
// A group of RTP packets for outgoing(send to players). // A group of RTP packets for outgoing(send to players).
// TODO: FIXME: Rename to stat for RTP packets. class SrsRtcPlayStreamStatistic
class SrsRtcOutgoingInfo
{ {
public: public:
#if defined(SRS_DEBUG) #if defined(SRS_DEBUG)
@ -160,8 +160,8 @@ public:
// The number of padded packet. // The number of padded packet.
int nn_paddings; int nn_paddings;
public: public:
SrsRtcOutgoingInfo(); SrsRtcPlayStreamStatistic();
virtual ~SrsRtcOutgoingInfo(); virtual ~SrsRtcPlayStreamStatistic();
}; };
// A RTC play stream, client pull and play stream from SRS. // A RTC play stream, client pull and play stream from SRS.
@ -184,8 +184,8 @@ private:
private: private:
// Whether palyer started. // Whether palyer started.
bool is_started; bool is_started;
// statistic send packets. // The statistic for consumer to send packets to player.
SrsRtcOutgoingInfo info; SrsRtcPlayStreamStatistic info;
public: public:
SrsRtcPlayStream(SrsRtcConnection* s, SrsContextId parent_cid); SrsRtcPlayStream(SrsRtcConnection* s, SrsContextId parent_cid);
virtual ~SrsRtcPlayStream(); virtual ~SrsRtcPlayStream();
@ -205,7 +205,7 @@ public:
public: public:
virtual srs_error_t cycle(); virtual srs_error_t cycle();
private: private:
srs_error_t send_packets(SrsRtcStream* source, const std::vector<SrsRtpPacket2*>& pkts, SrsRtcOutgoingInfo& info); srs_error_t send_packets(SrsRtcStream* source, const std::vector<SrsRtpPacket2*>& pkts, SrsRtcPlayStreamStatistic& info);
public: public:
void nack_fetch(std::vector<SrsRtpPacket2*>& pkts, uint32_t ssrc, uint16_t seq); void nack_fetch(std::vector<SrsRtpPacket2*>& pkts, uint32_t ssrc, uint16_t seq);
public: public:
@ -328,7 +328,7 @@ private:
std::string peer_id_; std::string peer_id_;
private: private:
// The timeout of session, keep alive by STUN ping pong. // 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; srs_utime_t last_stun_time;
private: private:
// For each RTC session, we use a specified cid for debugging logs. // For each RTC session, we use a specified cid for debugging logs.
@ -404,7 +404,7 @@ public:
// Simulate the NACK to drop nn packets. // Simulate the NACK to drop nn packets.
void simulate_nack_drop(int nn); void simulate_nack_drop(int nn);
void simulate_player_drop_packet(SrsRtpHeader* h, int nn_bytes); void simulate_player_drop_packet(SrsRtpHeader* h, int nn_bytes);
srs_error_t do_send_packets(const std::vector<SrsRtpPacket2*>& pkts, SrsRtcOutgoingInfo& info); srs_error_t do_send_packets(const std::vector<SrsRtpPacket2*>& pkts, SrsRtcPlayStreamStatistic& info);
private: private:
srs_error_t on_binding_request(SrsStunPacket* r); srs_error_t on_binding_request(SrsStunPacket* r);
// publish media capabilitiy negotiate // publish media capabilitiy negotiate

View file

@ -1728,7 +1728,7 @@ std::string SrsRtcSendTrack::get_track_id()
return track_desc_->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; 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; 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; srs_error_t err = srs_success;

View file

@ -54,7 +54,7 @@ class SrsRtcConnection;
class SrsRtpRingBuffer; class SrsRtpRingBuffer;
class SrsRtpNackForReceiver; class SrsRtpNackForReceiver;
class SrsJsonObject; class SrsJsonObject;
class SrsRtcOutgoingInfo; class SrsRtcPlayStreamStatistic;
class SrsNtp class SrsNtp
{ {
@ -471,7 +471,7 @@ public:
void set_track_status(bool active); void set_track_status(bool active);
std::string get_track_id(); std::string get_track_id();
public: 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); virtual srs_error_t on_rtcp(SrsRtpPacket2* pkt);
}; };
@ -481,7 +481,7 @@ public:
SrsRtcAudioSendTrack(SrsRtcConnection* session, SrsRtcTrackDescription* track_desc); SrsRtcAudioSendTrack(SrsRtcConnection* session, SrsRtcTrackDescription* track_desc);
virtual ~SrsRtcAudioSendTrack(); virtual ~SrsRtcAudioSendTrack();
public: 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); virtual srs_error_t on_rtcp(SrsRtpPacket2* pkt);
}; };
@ -491,7 +491,7 @@ public:
SrsRtcVideoSendTrack(SrsRtcConnection* session, SrsRtcTrackDescription* track_desc); SrsRtcVideoSendTrack(SrsRtcConnection* session, SrsRtcTrackDescription* track_desc);
virtual ~SrsRtcVideoSendTrack(); virtual ~SrsRtcVideoSendTrack();
public: 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); virtual srs_error_t on_rtcp(SrsRtpPacket2* pkt);
}; };