mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
SquashSRS4: Refine the init of global objects
This commit is contained in:
parent
276bd2223e
commit
3256c7c2fa
20 changed files with 412 additions and 153 deletions
|
@ -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()
|
||||
{
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -64,8 +64,6 @@ public:
|
|||
SrsPps();
|
||||
virtual ~SrsPps();
|
||||
public:
|
||||
// Setup the clock, use global clock if not set.
|
||||
void set_clock(SrsWallClock* clk);
|
||||
// Update with the nn which is target.
|
||||
void update();
|
||||
// Update with the nn.
|
||||
|
|
|
@ -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
|
||||
|
@ -1081,12 +1081,12 @@ bool SrsRtpPacket2::is_keyframe()
|
|||
return false;
|
||||
}
|
||||
|
||||
SrsRtpObjectCacheManager<SrsRtpPacket2>* _srs_rtp_cache = new SrsRtpObjectCacheManager<SrsRtpPacket2>(sizeof(SrsRtpPacket2));
|
||||
SrsRtpObjectCacheManager<SrsRtpRawPayload>* _srs_rtp_raw_cache = new SrsRtpObjectCacheManager<SrsRtpRawPayload>(sizeof(SrsRtpRawPayload));
|
||||
SrsRtpObjectCacheManager<SrsRtpFUAPayload2>* _srs_rtp_fua_cache = new SrsRtpObjectCacheManager<SrsRtpFUAPayload2>(sizeof(SrsRtpFUAPayload2));
|
||||
SrsRtpObjectCacheManager<SrsRtpPacket2>* _srs_rtp_cache = NULL;
|
||||
SrsRtpObjectCacheManager<SrsRtpRawPayload>* _srs_rtp_raw_cache = NULL;
|
||||
SrsRtpObjectCacheManager<SrsRtpFUAPayload2>* _srs_rtp_fua_cache = NULL;
|
||||
|
||||
SrsRtpObjectCacheManager<SrsSharedPtrMessage>* _srs_rtp_msg_cache_buffers = new SrsRtpObjectCacheManager<SrsSharedPtrMessage>(sizeof(SrsSharedPtrMessage) + kRtpPacketSize);
|
||||
SrsRtpObjectCacheManager<SrsSharedPtrMessage>* _srs_rtp_msg_cache_objs = new SrsRtpObjectCacheManager<SrsSharedPtrMessage>(sizeof(SrsSharedPtrMessage));
|
||||
SrsRtpObjectCacheManager<SrsSharedPtrMessage>* _srs_rtp_msg_cache_buffers = NULL;
|
||||
SrsRtpObjectCacheManager<SrsSharedPtrMessage>* _srs_rtp_msg_cache_objs = NULL;
|
||||
|
||||
SrsRtpRawPayload::SrsRtpRawPayload()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue