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

Kernel: Never depends on another globals for global variables

This commit is contained in:
winlin 2021-02-25 14:06:18 +08:00
parent d8ba72fdc5
commit 6dac180627
11 changed files with 88 additions and 76 deletions

View file

@ -59,9 +59,9 @@ void srs_pps_update(SrsRateSample& sample, int64_t nn, srs_utime_t now)
sample.update(nn, now, pps);
}
SrsPps::SrsPps(SrsWallClock* c)
SrsPps::SrsPps()
{
clk_ = c;
clk_ = NULL;
sugar = 0;
}
@ -69,6 +69,11 @@ SrsPps::~SrsPps()
{
}
void SrsPps::set_clock(SrsWallClock* clk)
{
clk_ = clk;
}
void SrsPps::update()
{
update(sugar);
@ -76,6 +81,11 @@ void SrsPps::update()
void SrsPps::update(int64_t nn)
{
// Lazy setup the clock.
if (!clk_) {
clk_ = _srs_clock;
}
srs_utime_t now = clk_->now();
srs_pps_init(sample_10s_, nn, now);