Skip to content

Commit

Permalink
Threads-RECV: Show the dropped packets pps.
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Apr 26, 2021
1 parent 6fca411 commit 185359f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions trunk/src/app/srs_app_rtc_server.cpp
Expand Up @@ -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()
{
Expand Down Expand Up @@ -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;
}

Expand Down
3 changes: 3 additions & 0 deletions trunk/src/app/srs_app_threads.cpp
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions trunk/src/app/srs_app_utility.cpp
Expand Up @@ -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
Expand Down

0 comments on commit 185359f

Please sign in to comment.