RTC Stat the detail of send packets

pull/2204/head
winlin 4 years ago
parent d92ceaca39
commit 09bd1b9faa

@ -49,6 +49,8 @@ SrsPps* _srs_pps_rpkts = new SrsPps(_srs_clock);
SrsPps* _srs_pps_addrs = new SrsPps(_srs_clock);
SrsPps* _srs_pps_fast_addrs = new SrsPps(_srs_clock);
SrsPps* _srs_pps_spkts = new SrsPps(_srs_clock);
// set the max packet size.
#define SRS_UDP_MAX_PACKET_SIZE 65535
@ -352,6 +354,8 @@ srs_error_t SrsUdpMuxSocket::sendto(void* data, int size, srs_utime_t timeout)
{
srs_error_t err = srs_success;
++_srs_pps_spkts->sugar;
int nb_write = srs_sendto(lfd, data, size, (sockaddr*)&from, fromlen, timeout);
if (nb_write <= 0) {

@ -60,6 +60,11 @@ using namespace std;
#include <srs_protocol_kbps.hpp>
SrsPps* _srs_pps_sstuns = new SrsPps(_srs_clock);
SrsPps* _srs_pps_stwcc = new SrsPps(_srs_clock);
SrsPps* _srs_pps_srtcps = new SrsPps(_srs_clock);
SrsPps* _srs_pps_srtps = new SrsPps(_srs_clock);
SrsPps* _srs_pps_pli = new SrsPps(_srs_clock);
SrsPps* _srs_pps_twcc = new SrsPps(_srs_clock);
SrsPps* _srs_pps_rr = new SrsPps(_srs_clock);
@ -118,6 +123,8 @@ srs_error_t SrsSecurityTransport::write_dtls_data(void* data, int size)
return err;
}
++_srs_pps_sstuns->sugar;
if ((err = session_->sendonly_skt->sendto(data, size, 0)) != srs_success) {
return srs_error_wrap(err, "send dtls packet");
}
@ -1293,6 +1300,8 @@ srs_error_t SrsRtcPublishStream::send_periodic_twcc()
return err;
}
++_srs_pps_stwcc->sugar;
char pkt[kRtcpPacketSize];
SrsBuffer *buffer = new SrsBuffer(pkt, sizeof(pkt));
SrsAutoFree(SrsBuffer, buffer);
@ -2298,6 +2307,8 @@ srs_error_t SrsRtcConnection::send_rtcp(char *data, int nb_data)
{
srs_error_t err = srs_success;
++_srs_pps_srtcps->sugar;
int nb_buf = nb_data;
if ((err = transport_->protect_rtcp(data, &nb_buf)) != srs_success) {
return srs_error_wrap(err, "protect rtcp");
@ -2324,6 +2335,7 @@ void SrsRtcConnection::check_send_nacks(SrsRtpNackForReceiver* nack, uint32_t ss
}
++_srs_pps_snack2->sugar;
++_srs_pps_srtcps->sugar;
char buf[kRtcpPacketSize];
SrsBuffer stream(buf, sizeof(buf));
@ -2343,6 +2355,8 @@ srs_error_t SrsRtcConnection::send_rtcp_rr(uint32_t ssrc, SrsRtpRingBuffer* rtp_
{
srs_error_t err = srs_success;
++_srs_pps_srtcps->sugar;
// @see https://tools.ietf.org/html/rfc3550#section-6.4.2
char buf[kRtpPacketSize];
SrsBuffer stream(buf, sizeof(buf));
@ -2388,6 +2402,8 @@ srs_error_t SrsRtcConnection::send_rtcp_xr_rrtr(uint32_t ssrc)
{
srs_error_t err = srs_success;
++_srs_pps_srtcps->sugar;
/*
@see: http://www.rfc-editor.org/rfc/rfc3611.html#section-2
@ -2440,6 +2456,8 @@ srs_error_t SrsRtcConnection::send_rtcp_fb_pli(uint32_t ssrc, const SrsContextId
{
srs_error_t err = srs_success;
++_srs_pps_srtcps->sugar;
char buf[kRtpPacketSize];
SrsBuffer stream(buf, sizeof(buf));
stream.write_1bytes(0x81);
@ -2532,6 +2550,8 @@ srs_error_t SrsRtcConnection::do_send_packets(const std::vector<SrsRtpPacket2*>&
continue;
}
++_srs_pps_srtps->sugar;
// TODO: FIXME: Handle error.
sendonly_skt->sendto(iov->iov_base, iov->iov_len, 0);
@ -2578,6 +2598,8 @@ srs_error_t SrsRtcConnection::on_binding_request(SrsStunPacket* r)
{
srs_error_t err = srs_success;
++_srs_pps_sstuns->sugar;
bool strict_check = _srs_config->get_rtc_stun_strict_check(req->vhost);
if (strict_check && r->get_ice_controlled()) {
// @see: https://tools.ietf.org/html/draft-ietf-ice-rfc5245bis-00#section-6.1.3.1

@ -52,6 +52,12 @@ SrsPps* _srs_pps_rrtcps = new SrsPps(_srs_clock);
extern SrsPps* _srs_pps_addrs;
extern SrsPps* _srs_pps_fast_addrs;
extern SrsPps* _srs_pps_spkts;
extern SrsPps* _srs_pps_sstuns;
extern SrsPps* _srs_pps_stwcc;
extern SrsPps* _srs_pps_srtcps;
extern SrsPps* _srs_pps_srtps;
extern SrsPps* _srs_pps_ids;
extern SrsPps* _srs_pps_fids;
extern SrsPps* _srs_pps_fids_level0;
@ -669,16 +675,18 @@ srs_error_t SrsRtcServer::notify(int type, srs_utime_t interval, srs_utime_t tic
}
// Update the pps stat for UDP socket and adddresses.
_srs_pps_rpkts->update(); _srs_pps_rstuns->update(); _srs_pps_rrtps->update(); _srs_pps_rrtcps->update(); _srs_pps_addrs->update(); _srs_pps_fast_addrs->update();
_srs_pps_rpkts->update(); _srs_pps_rrtps->update(); _srs_pps_rstuns->update(); _srs_pps_rrtcps->update(); _srs_pps_addrs->update(); _srs_pps_fast_addrs->update();
_srs_pps_spkts->update(); _srs_pps_srtps->update(); _srs_pps_sstuns->update(); _srs_pps_stwcc->update(); _srs_pps_srtcps->update();
_srs_pps_ids->update(); _srs_pps_fids->update(); _srs_pps_fids_level0->update();
_srs_pps_pli->update(); _srs_pps_twcc->update(); _srs_pps_rr->update();
_srs_pps_snack->update(); _srs_pps_snack2->update(); _srs_pps_sanack->update(); _srs_pps_svnack->update();
_srs_pps_rnack->update(); _srs_pps_rnack2->update();
// TODO: FIXME: Show more data for RTC server.
srs_trace("RTC: Server conns=%u, rpkts=%d,%d,%d,%d,%d,%d, fid=%d,%d,%d, rtcp=%d,%d,%d, snk=%d,%d,%d,%d, rnk=%d,%d",
srs_trace("RTC: Server conns=%u, rpkts=%d,%d,%d,%d,%d,%d, spkts=%d,%d,%d,%d,%d, fid=%d,%d,%d, rtcp=%d,%d,%d, snk=%d,%d,%d,%d, rnk=%d,%d",
nn_rtc_conns,
_srs_pps_rpkts->r10s(), _srs_pps_rstuns->r10s(), _srs_pps_rrtps->r10s(), _srs_pps_rrtcps->r10s(), _srs_pps_addrs->r10s(), _srs_pps_fast_addrs->r10s(),
_srs_pps_rpkts->r10s(), _srs_pps_rrtps->r10s(), _srs_pps_rstuns->r10s(), _srs_pps_rrtcps->r10s(), _srs_pps_addrs->r10s(), _srs_pps_fast_addrs->r10s(),
_srs_pps_spkts->r10s(), _srs_pps_srtps->r10s(), _srs_pps_sstuns->r10s(), _srs_pps_stwcc->r10s(), _srs_pps_srtcps->r10s(),
_srs_pps_ids->r10s(), _srs_pps_fids->r10s(), _srs_pps_fids_level0->r10s(),
_srs_pps_pli->r10s(), _srs_pps_twcc->r10s(), _srs_pps_rr->r10s(),
_srs_pps_snack->r10s(), _srs_pps_snack2->r10s(), _srs_pps_sanack->r10s(), _srs_pps_svnack->r10s(),

Loading…
Cancel
Save