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
							
								
									4539ffa086
								
							
						
					
					
						commit
						515529eba9
					
				
					 2 changed files with 19 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -61,6 +61,9 @@ using namespace std;
 | 
			
		|||
#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
 | 
			
		||||
| 
						 | 
				
			
			@ -1429,11 +1432,15 @@ srs_error_t SrsRtcPublishStream::notify(int type, srs_utime_t interval, srs_utim
 | 
			
		|||
{
 | 
			
		||||
    srs_error_t err = srs_success;
 | 
			
		||||
 | 
			
		||||
    ++_srs_pps_pub->sugar;
 | 
			
		||||
 | 
			
		||||
    if (!is_started) {
 | 
			
		||||
        return err;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (type == SRS_TICKID_RTCP) {
 | 
			
		||||
        ++_srs_pps_rr->sugar;
 | 
			
		||||
 | 
			
		||||
        if ((err = send_rtcp_rr()) != srs_success) {
 | 
			
		||||
            srs_warn("RR err %s", srs_error_desc(err).c_str());
 | 
			
		||||
            srs_freep(err);
 | 
			
		||||
| 
						 | 
				
			
			@ -1446,6 +1453,8 @@ srs_error_t SrsRtcPublishStream::notify(int type, srs_utime_t interval, srs_utim
 | 
			
		|||
    }
 | 
			
		||||
 | 
			
		||||
    if (twcc_enabled_ && type == SRS_TICKID_TWCC) {
 | 
			
		||||
        ++_srs_pps_twcc->sugar;
 | 
			
		||||
 | 
			
		||||
        // We should not depends on the received packet,
 | 
			
		||||
        // instead we should send feedback every Nms.
 | 
			
		||||
        if ((err = send_periodic_twcc()) != srs_success) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -57,7 +57,11 @@ extern SrsPps* _srs_pps_cids_get;
 | 
			
		|||
extern SrsPps* _srs_pps_cids_set;
 | 
			
		||||
 | 
			
		||||
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;
 | 
			
		||||
extern SrsPps* _srs_pps_dispose;
 | 
			
		||||
 | 
			
		||||
SrsRtcBlackhole::SrsRtcBlackhole()
 | 
			
		||||
| 
						 | 
				
			
			@ -657,15 +661,18 @@ srs_error_t SrsRtcServer::notify(int type, srs_utime_t interval, srs_utime_t tic
 | 
			
		|||
    _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_cids_get->update(); _srs_pps_cids_set->update();
 | 
			
		||||
    _srs_pps_pli->update(); _srs_pps_timer->update(); _srs_pps_dispose->update();
 | 
			
		||||
    _srs_pps_pli->update(); _srs_pps_twcc->update(); _srs_pps_rr->update();
 | 
			
		||||
    _srs_pps_timer->update(); _srs_pps_pub->update(); _srs_pps_dispose->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, cid=%d,%d, pli=%d, timer=%d, dispose=%d",
 | 
			
		||||
    srs_trace("RTC: Server conns=%u, cpu=%.2f%%, rss=%dMB, pkts=%d, addrs=%d,%d, fid=%d,%d,%d, cid=%d,%d, rtcp=%d,%d,%d, timer=%d,%d, dispose=%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_cids_get->r10s(), _srs_pps_cids_set->r10s(),
 | 
			
		||||
        _srs_pps_pli->r10s(), _srs_pps_timer->r10s(), _srs_pps_dispose->r10s()
 | 
			
		||||
        _srs_pps_pli->r10s(), _srs_pps_twcc->r10s(), _srs_pps_rr->r10s(),
 | 
			
		||||
        _srs_pps_timer->r10s(), _srs_pps_pub->r10s(),
 | 
			
		||||
        _srs_pps_dispose->r10s()
 | 
			
		||||
    );
 | 
			
		||||
 | 
			
		||||
    return err;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue