From 185359f7114b22dcee5314bbd27d5bb426bc91be Mon Sep 17 00:00:00 2001 From: winlin Date: Tue, 16 Mar 2021 20:29:35 +0800 Subject: [PATCH] Threads-RECV: Show the dropped packets pps. --- trunk/src/app/srs_app_rtc_server.cpp | 6 ++++-- trunk/src/app/srs_app_threads.cpp | 3 +++ trunk/src/app/srs_app_utility.cpp | 1 + 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/trunk/src/app/srs_app_rtc_server.cpp b/trunk/src/app/srs_app_rtc_server.cpp index c66f55d3df..cd7742a0bb 100644 --- a/trunk/src/app/srs_app_rtc_server.cpp +++ b/trunk/src/app/srs_app_rtc_server.cpp @@ -77,6 +77,7 @@ extern SrsPps* _srs_pps_rmnack; extern SrsPps* _srs_pps_rloss; extern SrsPps* _srs_pps_sloss; +extern SrsPps* _srs_pps_aloss; SrsRtcBlackhole::SrsRtcBlackhole() { @@ -701,8 +702,9 @@ srs_error_t SrsRtcServer::on_timer(srs_utime_t interval, srs_utime_t tick) // TODO: FIXME: Should move to Hybrid server stat. string loss_desc; - if (_srs_pps_rloss->r10s() || _srs_pps_sloss->r10s()) { - snprintf(buf, sizeof(buf), ", loss=(r:%d,s:%d)", _srs_pps_rloss->r10s(), _srs_pps_sloss->r10s()); + _srs_pps_aloss->update(); + if (_srs_pps_rloss->r10s() || _srs_pps_sloss->r10s() || _srs_pps_aloss->r10s()) { + snprintf(buf, sizeof(buf), ", loss=(r:%d,s:%d,a:%d)", _srs_pps_rloss->r10s(), _srs_pps_sloss->r10s(), _srs_pps_aloss->r10s()); loss_desc = buf; } diff --git a/trunk/src/app/srs_app_threads.cpp b/trunk/src/app/srs_app_threads.cpp index debeb32add..327b894c0b 100644 --- a/trunk/src/app/srs_app_threads.cpp +++ b/trunk/src/app/srs_app_threads.cpp @@ -40,6 +40,8 @@ SrsPps* _srs_thread_sync_100us = new SrsPps(); SrsPps* _srs_thread_sync_1000us = new SrsPps(); SrsPps* _srs_thread_sync_plus = new SrsPps(); +extern SrsPps* _srs_pps_aloss; + uint64_t srs_covert_cpuset(cpu_set_t v) { #ifdef SRS_OSX @@ -897,6 +899,7 @@ srs_error_t SrsAsyncRecvManager::do_start() // Drop packet if exceed max recv queue size. if ((int)packets_->size() >= max_recv_queue_) { + ++_srs_pps_aloss->sugar; continue; } diff --git a/trunk/src/app/srs_app_utility.cpp b/trunk/src/app/srs_app_utility.cpp index 1961ab54ad..8823b4fc06 100644 --- a/trunk/src/app/srs_app_utility.cpp +++ b/trunk/src/app/srs_app_utility.cpp @@ -54,6 +54,7 @@ using namespace std; SrsPps* _srs_pps_rloss = new SrsPps(); SrsPps* _srs_pps_sloss = new SrsPps(); +SrsPps* _srs_pps_aloss = new SrsPps(); // the longest time to wait for a process to quit. #define SRS_PROCESS_QUIT_TIMEOUT_MS 1000