1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

RTC: update stat for pli, timer and dispose

This commit is contained in:
winlin 2021-02-08 11:45:34 +08:00
parent aefd7fccd0
commit 18c27111e0
5 changed files with 34 additions and 10 deletions

View file

@ -28,6 +28,10 @@ using namespace std;
#include <srs_kernel_error.hpp>
#include <srs_kernel_log.hpp>
#include <srs_protocol_kbps.hpp>
SrsPps* _srs_pps_timer = new SrsPps(_srs_clock);
ISrsHourGlass::ISrsHourGlass()
{
}
@ -36,12 +40,13 @@ ISrsHourGlass::~ISrsHourGlass()
{
}
SrsHourGlass::SrsHourGlass(ISrsHourGlass* h, srs_utime_t resolution)
SrsHourGlass::SrsHourGlass(string label, ISrsHourGlass* h, srs_utime_t resolution)
{
label_ = label;
handler = h;
_resolution = resolution;
total_elapse = 0;
trd = new SrsSTCoroutine("timer", this, _srs_context->get_id());
trd = new SrsSTCoroutine("timer-" + label, this, _srs_context->get_id());
}
SrsHourGlass::~SrsHourGlass()
@ -94,6 +99,8 @@ srs_error_t SrsHourGlass::cycle()
srs_utime_t interval = it->second;
if (interval == 0 || (total_elapse % interval) == 0) {
++_srs_pps_timer->sugar;
if ((err = handler->notify(event, interval, total_elapse)) != srs_success) {
return srs_error_wrap(err, "notify");
}