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

Refine init of global SrsPps

This commit is contained in:
winlin 2021-05-08 11:11:13 +08:00
parent b6f2745822
commit b1e85664a1
14 changed files with 304 additions and 100 deletions

View file

@ -43,7 +43,7 @@ using namespace std;
#include <srs_kernel_kbps.hpp>
SrsPps* _srs_pps_objs_msgs = new SrsPps();
SrsPps* _srs_pps_objs_msgs = NULL;
SrsMessageHeader::SrsMessageHeader()
{

View file

@ -61,7 +61,7 @@ void srs_pps_update(SrsRateSample& sample, int64_t nn, srs_utime_t now)
SrsPps::SrsPps()
{
clk_ = NULL;
clk_ = _srs_clock;
sugar = 0;
}
@ -69,11 +69,6 @@ SrsPps::~SrsPps()
{
}
void SrsPps::set_clock(SrsWallClock* clk)
{
clk_ = clk;
}
void SrsPps::update()
{
update(sugar);
@ -81,10 +76,7 @@ void SrsPps::update()
void SrsPps::update(int64_t nn)
{
// Lazy setup the clock.
if (!clk_) {
clk_ = _srs_clock;
}
srs_assert(clk_);
srs_utime_t now = clk_->now();
@ -129,5 +121,5 @@ srs_utime_t SrsWallClock::now()
return srs_get_system_time();
}
SrsWallClock* _srs_clock = new SrsWallClock();
SrsWallClock* _srs_clock = NULL;

View file

@ -63,9 +63,6 @@ public:
public:
SrsPps();
virtual ~SrsPps();
private:
// Setup the clock, use global clock if not set.
void set_clock(SrsWallClock* clk);
public:
// Update with the nn which is target.
void update();

View file

@ -36,12 +36,12 @@ using namespace std;
#include <srs_kernel_kbps.hpp>
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();
SrsPps* _srs_pps_objs_rothers = new SrsPps();
SrsPps* _srs_pps_objs_drop = new SrsPps();
SrsPps* _srs_pps_objs_rtps = NULL;
SrsPps* _srs_pps_objs_rraw = NULL;
SrsPps* _srs_pps_objs_rfua = NULL;
SrsPps* _srs_pps_objs_rbuf = NULL;
SrsPps* _srs_pps_objs_rothers = NULL;
SrsPps* _srs_pps_objs_drop = NULL;
/* @see https://tools.ietf.org/html/rfc1889#section-5.1
0 1 2 3