mirror of
				https://github.com/ossrs/srs.git
				synced 2025-03-09 15:49:59 +00:00 
			
		
		
		
	RTC: Update stat for twcc and rr
This commit is contained in:
		
							parent
							
								
									86d615f27e
								
							
						
					
					
						commit
						154ae9b4eb
					
				
					 2 changed files with 27 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -58,6 +58,13 @@ using namespace std;
 | 
			
		|||
#include <srs_app_rtc_source.hpp>
 | 
			
		||||
#include <srs_protocol_utility.hpp>
 | 
			
		||||
 | 
			
		||||
#include <srs_protocol_kbps.hpp>
 | 
			
		||||
 | 
			
		||||
SrsPps* _srs_pps_pli = new SrsPps(_srs_clock);
 | 
			
		||||
SrsPps* _srs_pps_twcc = new SrsPps(_srs_clock);
 | 
			
		||||
SrsPps* _srs_pps_rr = new SrsPps(_srs_clock);
 | 
			
		||||
SrsPps* _srs_pps_pub = new SrsPps(_srs_clock);
 | 
			
		||||
 | 
			
		||||
#define SRS_TICKID_RTCP 0
 | 
			
		||||
#define SRS_TICKID_TWCC 2
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -331,6 +338,8 @@ srs_error_t SrsRtcPLIWorker::cycle()
 | 
			
		|||
                uint32_t ssrc = it->first;
 | 
			
		||||
                SrsContextId cid = it->second;
 | 
			
		||||
 | 
			
		||||
                ++_srs_pps_pli->sugar;
 | 
			
		||||
 | 
			
		||||
                if ((err = handler_->do_request_keyframe(ssrc, cid)) != srs_success) {
 | 
			
		||||
                    srs_warn("PLI error, %s", srs_error_desc(err).c_str());
 | 
			
		||||
                    srs_error_reset(err);
 | 
			
		||||
| 
						 | 
				
			
			@ -373,7 +382,7 @@ SrsRtcPlayStream::SrsRtcPlayStream(SrsRtcConnection* s, const SrsContextId& cid)
 | 
			
		|||
    nack_enabled_ = false;
 | 
			
		||||
 | 
			
		||||
    _srs_config->subscribe(this);
 | 
			
		||||
    timer_ = new SrsHourGlass(this, 1000 * SRS_UTIME_MILLISECONDS);
 | 
			
		||||
    timer_ = new SrsHourGlass("play", this, 1000 * SRS_UTIME_MILLISECONDS);
 | 
			
		||||
    nack_epp = new SrsErrorPithyPrint();
 | 
			
		||||
    pli_worker_ = new SrsRtcPLIWorker(this);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -855,7 +864,7 @@ srs_error_t SrsRtcPlayStream::do_request_keyframe(uint32_t ssrc, SrsContextId ci
 | 
			
		|||
 | 
			
		||||
SrsRtcPublishStream::SrsRtcPublishStream(SrsRtcConnection* session, const SrsContextId& cid)
 | 
			
		||||
{
 | 
			
		||||
    timer_ = new SrsHourGlass(this, 20 * SRS_UTIME_MILLISECONDS);
 | 
			
		||||
    timer_ = new SrsHourGlass("publish", this, 20 * SRS_UTIME_MILLISECONDS);
 | 
			
		||||
 | 
			
		||||
    cid_ = cid;
 | 
			
		||||
    is_started = false;
 | 
			
		||||
| 
						 | 
				
			
			@ -1272,7 +1281,7 @@ srs_error_t SrsRtcPublishStream::send_periodic_twcc()
 | 
			
		|||
        uint32_t nn = 0;
 | 
			
		||||
        srs_utime_t duration = srs_duration(last_time_send_twcc_, srs_get_system_time());
 | 
			
		||||
        if (duration > 80 * SRS_UTIME_MILLISECONDS && twcc_epp_->can_print(0, &nn)) {
 | 
			
		||||
            srs_warn2(TAG_LARGE_TIMER, "send_twcc interval exceeded %dms > 100ms, count=%u/%u",
 | 
			
		||||
            srs_warn2(TAG_LARGE_TIMER, "send_twcc interval exceeded %dms > 80ms, count=%u/%u",
 | 
			
		||||
                srsu2msi(duration), nn, twcc_epp_->nn_count);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -1573,7 +1582,7 @@ SrsRtcConnection::SrsRtcConnection(SrsRtcServer* s, const SrsContextId& cid)
 | 
			
		|||
    req = NULL;
 | 
			
		||||
    cid_ = cid;
 | 
			
		||||
    stat_ = new SrsRtcConnectionStatistic();
 | 
			
		||||
    timer_ = new SrsHourGlass(this, 1000 * SRS_UTIME_MILLISECONDS);
 | 
			
		||||
    timer_ = new SrsHourGlass("conn", this, 1000 * SRS_UTIME_MILLISECONDS);
 | 
			
		||||
    hijacker_ = NULL;
 | 
			
		||||
 | 
			
		||||
    sendonly_skt = NULL;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -53,6 +53,13 @@ extern SrsPps* _srs_pps_ids;
 | 
			
		|||
extern SrsPps* _srs_pps_fids;
 | 
			
		||||
extern SrsPps* _srs_pps_fids_level0;
 | 
			
		||||
 | 
			
		||||
extern SrsPps* _srs_pps_pli;
 | 
			
		||||
extern SrsPps* _srs_pps_twcc;
 | 
			
		||||
extern SrsPps* _srs_pps_rr;
 | 
			
		||||
 | 
			
		||||
extern SrsPps* _srs_pps_timer;
 | 
			
		||||
extern SrsPps* _srs_pps_pub;
 | 
			
		||||
 | 
			
		||||
SrsRtcBlackhole::SrsRtcBlackhole()
 | 
			
		||||
{
 | 
			
		||||
    blackhole = false;
 | 
			
		||||
| 
						 | 
				
			
			@ -225,7 +232,7 @@ SrsRtcServer::SrsRtcServer()
 | 
			
		|||
{
 | 
			
		||||
    handler = NULL;
 | 
			
		||||
    hijacker = NULL;
 | 
			
		||||
    timer = new SrsHourGlass(this, 1 * SRS_UTIME_SECONDS);
 | 
			
		||||
    timer = new SrsHourGlass("server", this, 1 * SRS_UTIME_SECONDS);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SrsRtcServer::~SrsRtcServer()
 | 
			
		||||
| 
						 | 
				
			
			@ -649,12 +656,16 @@ 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_pkts->update(); _srs_pps_addrs->update(); _srs_pps_fast_addrs->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_timer->update(); _srs_pps_pub->update();
 | 
			
		||||
 | 
			
		||||
    // TODO: FIXME: Show more data for RTC server.
 | 
			
		||||
    srs_trace("RTC: Server conns=%u, cpu=%.2f%%, rss=%dMB, pkts=%d, addrs=%d,%d, fid=%d,%d,%d",
 | 
			
		||||
    srs_trace("RTC: Server conns=%u, cpu=%.2f%%, rss=%dMB, pkts=%d, addrs=%d,%d, fid=%d,%d,%d, rtcp=%d,%d,%d, timer=%d,%d",
 | 
			
		||||
        nn_rtc_conns, u->percent * 100, memory,
 | 
			
		||||
        _srs_pps_pkts->r10s(), _srs_pps_addrs->r10s(), _srs_pps_fast_addrs->r10s(),
 | 
			
		||||
        _srs_pps_ids->r10s(), _srs_pps_fids->r10s(), _srs_pps_fids_level0->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_timer->r10s(), _srs_pps_pub->r10s()
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    return err;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue