Skip to content

Commit

Permalink
RTC: Stat the large buffer allocation
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Feb 26, 2021
1 parent 439a7fa commit 65ba88d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 4 additions & 3 deletions trunk/src/app/srs_app_rtc_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ extern SrsPps* _srs_pps_rmnack;
extern SrsPps* _srs_pps_objs_rtps;
extern SrsPps* _srs_pps_objs_rraw;
extern SrsPps* _srs_pps_objs_rfua;
extern SrsPps* _srs_pps_objs_rbuf;

SrsRtcBlackhole::SrsRtcBlackhole()
{
Expand Down Expand Up @@ -684,9 +685,9 @@ srs_error_t SrsRtcServer::notify(int type, srs_utime_t interval, srs_utime_t tic
static char buf[128];

string objs_desc;
_srs_pps_objs_rtps->update(); _srs_pps_objs_rraw->update(); _srs_pps_objs_rfua->update();
if (_srs_pps_objs_rtps->r10s() || _srs_pps_objs_rraw->r10s() || _srs_pps_objs_rfua->r10s()) {
snprintf(buf, sizeof(buf), ", objs=%d,%d,%d", _srs_pps_objs_rtps->r10s(), _srs_pps_objs_rraw->r10s(), _srs_pps_objs_rfua->r10s());
_srs_pps_objs_rtps->update(); _srs_pps_objs_rraw->update(); _srs_pps_objs_rfua->update(); _srs_pps_objs_rbuf->update();
if (_srs_pps_objs_rtps->r10s() || _srs_pps_objs_rraw->r10s() || _srs_pps_objs_rfua->r10s() || _srs_pps_objs_rbuf->r10s()) {
snprintf(buf, sizeof(buf), ", objs=%d,%d,%d,%d", _srs_pps_objs_rtps->r10s(), _srs_pps_objs_rraw->r10s(), _srs_pps_objs_rfua->r10s(), _srs_pps_objs_rbuf->r10s());
objs_desc = buf;
}

Expand Down
3 changes: 3 additions & 0 deletions trunk/src/kernel/srs_kernel_rtc_rtp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ using namespace std;
SrsPps* _srs_pps_objs_rtps = new SrsPps();
SrsPps* _srs_pps_objs_rraw = new SrsPps();
SrsPps* _srs_pps_objs_rfua = new SrsPps();
SrsPps* _srs_pps_objs_rbuf = new SrsPps();

/* @see https://tools.ietf.org/html/rfc1889#section-5.1
0 1 2 3
Expand Down Expand Up @@ -867,6 +868,8 @@ char* SrsRtpPacket2::wrap(int size)
srs_freep(cache_buffer_);
cache_buffer_ = new SrsBuffer(buf, size);

++_srs_pps_objs_rbuf->sugar;

return buf;
}

Expand Down

0 comments on commit 65ba88d

Please sign in to comment.