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:
parent
b6f2745822
commit
b1e85664a1
14 changed files with 304 additions and 100 deletions
|
@ -38,10 +38,10 @@ using namespace std;
|
|||
|
||||
#include <srs_protocol_kbps.hpp>
|
||||
|
||||
SrsPps* _srs_pps_ids = new SrsPps();
|
||||
SrsPps* _srs_pps_fids = new SrsPps();
|
||||
SrsPps* _srs_pps_fids_level0 = new SrsPps();
|
||||
SrsPps* _srs_pps_dispose = new SrsPps();
|
||||
SrsPps* _srs_pps_ids = NULL;
|
||||
SrsPps* _srs_pps_fids = NULL;
|
||||
SrsPps* _srs_pps_fids_level0 = NULL;
|
||||
SrsPps* _srs_pps_dispose = NULL;
|
||||
|
||||
ISrsDisposingHandler::ISrsDisposingHandler()
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@ using namespace std;
|
|||
|
||||
#include <srs_protocol_kbps.hpp>
|
||||
|
||||
SrsPps* _srs_pps_timer = new SrsPps();
|
||||
SrsPps* _srs_pps_timer = NULL;
|
||||
|
||||
extern SrsPps* _srs_pps_clock_15ms;
|
||||
extern SrsPps* _srs_pps_clock_20ms;
|
||||
|
|
|
@ -44,10 +44,10 @@ extern unsigned long long _st_stat_recvfrom;
|
|||
extern unsigned long long _st_stat_recvfrom_eagain;
|
||||
extern unsigned long long _st_stat_sendto;
|
||||
extern unsigned long long _st_stat_sendto_eagain;
|
||||
SrsPps* _srs_pps_recvfrom = new SrsPps();
|
||||
SrsPps* _srs_pps_recvfrom_eagain = new SrsPps();
|
||||
SrsPps* _srs_pps_sendto = new SrsPps();
|
||||
SrsPps* _srs_pps_sendto_eagain = new SrsPps();
|
||||
SrsPps* _srs_pps_recvfrom = NULL;
|
||||
SrsPps* _srs_pps_recvfrom_eagain = NULL;
|
||||
SrsPps* _srs_pps_sendto = NULL;
|
||||
SrsPps* _srs_pps_sendto_eagain = NULL;
|
||||
|
||||
extern unsigned long long _st_stat_read;
|
||||
extern unsigned long long _st_stat_read_eagain;
|
||||
|
@ -55,30 +55,30 @@ extern unsigned long long _st_stat_readv;
|
|||
extern unsigned long long _st_stat_readv_eagain;
|
||||
extern unsigned long long _st_stat_writev;
|
||||
extern unsigned long long _st_stat_writev_eagain;
|
||||
SrsPps* _srs_pps_read = new SrsPps();
|
||||
SrsPps* _srs_pps_read_eagain = new SrsPps();
|
||||
SrsPps* _srs_pps_readv = new SrsPps();
|
||||
SrsPps* _srs_pps_readv_eagain = new SrsPps();
|
||||
SrsPps* _srs_pps_writev = new SrsPps();
|
||||
SrsPps* _srs_pps_writev_eagain = new SrsPps();
|
||||
SrsPps* _srs_pps_read = NULL;
|
||||
SrsPps* _srs_pps_read_eagain = NULL;
|
||||
SrsPps* _srs_pps_readv = NULL;
|
||||
SrsPps* _srs_pps_readv_eagain = NULL;
|
||||
SrsPps* _srs_pps_writev = NULL;
|
||||
SrsPps* _srs_pps_writev_eagain = NULL;
|
||||
|
||||
extern unsigned long long _st_stat_recvmsg;
|
||||
extern unsigned long long _st_stat_recvmsg_eagain;
|
||||
extern unsigned long long _st_stat_sendmsg;
|
||||
extern unsigned long long _st_stat_sendmsg_eagain;
|
||||
SrsPps* _srs_pps_recvmsg = new SrsPps();
|
||||
SrsPps* _srs_pps_recvmsg_eagain = new SrsPps();
|
||||
SrsPps* _srs_pps_sendmsg = new SrsPps();
|
||||
SrsPps* _srs_pps_sendmsg_eagain = new SrsPps();
|
||||
SrsPps* _srs_pps_recvmsg = NULL;
|
||||
SrsPps* _srs_pps_recvmsg_eagain = NULL;
|
||||
SrsPps* _srs_pps_sendmsg = NULL;
|
||||
SrsPps* _srs_pps_sendmsg_eagain = NULL;
|
||||
|
||||
extern unsigned long long _st_stat_epoll;
|
||||
extern unsigned long long _st_stat_epoll_zero;
|
||||
extern unsigned long long _st_stat_epoll_shake;
|
||||
extern unsigned long long _st_stat_epoll_spin;
|
||||
SrsPps* _srs_pps_epoll = new SrsPps();
|
||||
SrsPps* _srs_pps_epoll_zero = new SrsPps();
|
||||
SrsPps* _srs_pps_epoll_shake = new SrsPps();
|
||||
SrsPps* _srs_pps_epoll_spin = new SrsPps();
|
||||
SrsPps* _srs_pps_epoll = NULL;
|
||||
SrsPps* _srs_pps_epoll_zero = NULL;
|
||||
SrsPps* _srs_pps_epoll_shake = NULL;
|
||||
SrsPps* _srs_pps_epoll_spin = NULL;
|
||||
|
||||
extern unsigned long long _st_stat_sched_15ms;
|
||||
extern unsigned long long _st_stat_sched_20ms;
|
||||
|
@ -89,26 +89,26 @@ extern unsigned long long _st_stat_sched_40ms;
|
|||
extern unsigned long long _st_stat_sched_80ms;
|
||||
extern unsigned long long _st_stat_sched_160ms;
|
||||
extern unsigned long long _st_stat_sched_s;
|
||||
SrsPps* _srs_pps_sched_15ms = new SrsPps();
|
||||
SrsPps* _srs_pps_sched_20ms = new SrsPps();
|
||||
SrsPps* _srs_pps_sched_25ms = new SrsPps();
|
||||
SrsPps* _srs_pps_sched_30ms = new SrsPps();
|
||||
SrsPps* _srs_pps_sched_35ms = new SrsPps();
|
||||
SrsPps* _srs_pps_sched_40ms = new SrsPps();
|
||||
SrsPps* _srs_pps_sched_80ms = new SrsPps();
|
||||
SrsPps* _srs_pps_sched_160ms = new SrsPps();
|
||||
SrsPps* _srs_pps_sched_s = new SrsPps();
|
||||
SrsPps* _srs_pps_sched_15ms = NULL;
|
||||
SrsPps* _srs_pps_sched_20ms = NULL;
|
||||
SrsPps* _srs_pps_sched_25ms = NULL;
|
||||
SrsPps* _srs_pps_sched_30ms = NULL;
|
||||
SrsPps* _srs_pps_sched_35ms = NULL;
|
||||
SrsPps* _srs_pps_sched_40ms = NULL;
|
||||
SrsPps* _srs_pps_sched_80ms = NULL;
|
||||
SrsPps* _srs_pps_sched_160ms = NULL;
|
||||
SrsPps* _srs_pps_sched_s = NULL;
|
||||
#endif
|
||||
|
||||
SrsPps* _srs_pps_clock_15ms = new SrsPps();
|
||||
SrsPps* _srs_pps_clock_20ms = new SrsPps();
|
||||
SrsPps* _srs_pps_clock_25ms = new SrsPps();
|
||||
SrsPps* _srs_pps_clock_30ms = new SrsPps();
|
||||
SrsPps* _srs_pps_clock_35ms = new SrsPps();
|
||||
SrsPps* _srs_pps_clock_40ms = new SrsPps();
|
||||
SrsPps* _srs_pps_clock_80ms = new SrsPps();
|
||||
SrsPps* _srs_pps_clock_160ms = new SrsPps();
|
||||
SrsPps* _srs_pps_timer_s = new SrsPps();
|
||||
SrsPps* _srs_pps_clock_15ms = NULL;
|
||||
SrsPps* _srs_pps_clock_20ms = NULL;
|
||||
SrsPps* _srs_pps_clock_25ms = NULL;
|
||||
SrsPps* _srs_pps_clock_30ms = NULL;
|
||||
SrsPps* _srs_pps_clock_35ms = NULL;
|
||||
SrsPps* _srs_pps_clock_40ms = NULL;
|
||||
SrsPps* _srs_pps_clock_80ms = NULL;
|
||||
SrsPps* _srs_pps_clock_160ms = NULL;
|
||||
SrsPps* _srs_pps_timer_s = NULL;
|
||||
|
||||
#if defined(SRS_DEBUG) && defined(SRS_DEBUG_STATS)
|
||||
extern int _st_active_count;
|
||||
|
@ -116,10 +116,10 @@ extern unsigned long long _st_stat_thread_run;
|
|||
extern unsigned long long _st_stat_thread_idle;
|
||||
extern unsigned long long _st_stat_thread_yield;
|
||||
extern unsigned long long _st_stat_thread_yield2;
|
||||
SrsPps* _srs_pps_thread_run = new SrsPps();
|
||||
SrsPps* _srs_pps_thread_idle = new SrsPps();
|
||||
SrsPps* _srs_pps_thread_yield = new SrsPps();
|
||||
SrsPps* _srs_pps_thread_yield2 = new SrsPps();
|
||||
SrsPps* _srs_pps_thread_run = NULL;
|
||||
SrsPps* _srs_pps_thread_idle = NULL;
|
||||
SrsPps* _srs_pps_thread_yield = NULL;
|
||||
SrsPps* _srs_pps_thread_yield2 = NULL;
|
||||
#endif
|
||||
|
||||
extern SrsPps* _srs_pps_objs_rtps;
|
||||
|
|
|
@ -45,11 +45,11 @@ using namespace std;
|
|||
|
||||
#include <srs_protocol_kbps.hpp>
|
||||
|
||||
SrsPps* _srs_pps_rpkts = new SrsPps();
|
||||
SrsPps* _srs_pps_addrs = new SrsPps();
|
||||
SrsPps* _srs_pps_fast_addrs = new SrsPps();
|
||||
SrsPps* _srs_pps_rpkts = NULL;
|
||||
SrsPps* _srs_pps_addrs = NULL;
|
||||
SrsPps* _srs_pps_fast_addrs = NULL;
|
||||
|
||||
SrsPps* _srs_pps_spkts = new SrsPps();
|
||||
SrsPps* _srs_pps_spkts = NULL;
|
||||
|
||||
// set the max packet size.
|
||||
#define SRS_UDP_MAX_PACKET_SIZE 65535
|
||||
|
|
|
@ -61,15 +61,15 @@ using namespace std;
|
|||
|
||||
#include <srs_protocol_kbps.hpp>
|
||||
|
||||
SrsPps* _srs_pps_sstuns = new SrsPps();
|
||||
SrsPps* _srs_pps_srtcps = new SrsPps();
|
||||
SrsPps* _srs_pps_srtps = new SrsPps();
|
||||
SrsPps* _srs_pps_sstuns = NULL;
|
||||
SrsPps* _srs_pps_srtcps = NULL;
|
||||
SrsPps* _srs_pps_srtps = NULL;
|
||||
|
||||
SrsPps* _srs_pps_pli = new SrsPps();
|
||||
SrsPps* _srs_pps_twcc = new SrsPps();
|
||||
SrsPps* _srs_pps_rr = new SrsPps();
|
||||
SrsPps* _srs_pps_pub = new SrsPps();
|
||||
SrsPps* _srs_pps_conn = new SrsPps();
|
||||
SrsPps* _srs_pps_pli = NULL;
|
||||
SrsPps* _srs_pps_twcc = NULL;
|
||||
SrsPps* _srs_pps_rr = NULL;
|
||||
SrsPps* _srs_pps_pub = NULL;
|
||||
SrsPps* _srs_pps_conn = NULL;
|
||||
|
||||
extern SrsPps* _srs_pps_snack;
|
||||
extern SrsPps* _srs_pps_snack2;
|
||||
|
|
|
@ -46,9 +46,9 @@ using namespace std;
|
|||
#include <srs_protocol_utility.hpp>
|
||||
|
||||
extern SrsPps* _srs_pps_rpkts;
|
||||
SrsPps* _srs_pps_rstuns = new SrsPps();
|
||||
SrsPps* _srs_pps_rrtps = new SrsPps();
|
||||
SrsPps* _srs_pps_rrtcps = new SrsPps();
|
||||
SrsPps* _srs_pps_rstuns = NULL;
|
||||
SrsPps* _srs_pps_rrtps = NULL;
|
||||
SrsPps* _srs_pps_rrtcps = NULL;
|
||||
extern SrsPps* _srs_pps_addrs;
|
||||
extern SrsPps* _srs_pps_fast_addrs;
|
||||
|
||||
|
|
|
@ -52,17 +52,17 @@
|
|||
#include <srs_protocol_kbps.hpp>
|
||||
|
||||
// The NACK sent by us(SFU).
|
||||
SrsPps* _srs_pps_snack = new SrsPps();
|
||||
SrsPps* _srs_pps_snack2 = new SrsPps();
|
||||
SrsPps* _srs_pps_snack3 = new SrsPps();
|
||||
SrsPps* _srs_pps_snack4 = new SrsPps();
|
||||
SrsPps* _srs_pps_sanack = new SrsPps();
|
||||
SrsPps* _srs_pps_svnack = new SrsPps();
|
||||
SrsPps* _srs_pps_snack = NULL;
|
||||
SrsPps* _srs_pps_snack2 = NULL;
|
||||
SrsPps* _srs_pps_snack3 = NULL;
|
||||
SrsPps* _srs_pps_snack4 = NULL;
|
||||
SrsPps* _srs_pps_sanack = NULL;
|
||||
SrsPps* _srs_pps_svnack = NULL;
|
||||
|
||||
SrsPps* _srs_pps_rnack = new SrsPps();
|
||||
SrsPps* _srs_pps_rnack2 = new SrsPps();
|
||||
SrsPps* _srs_pps_rhnack = new SrsPps();
|
||||
SrsPps* _srs_pps_rmnack = new SrsPps();
|
||||
SrsPps* _srs_pps_rnack = NULL;
|
||||
SrsPps* _srs_pps_rnack2 = NULL;
|
||||
SrsPps* _srs_pps_rhnack = NULL;
|
||||
SrsPps* _srs_pps_rmnack = NULL;
|
||||
|
||||
extern SrsPps* _srs_pps_aloss2;
|
||||
|
||||
|
|
|
@ -37,7 +37,111 @@ extern SrsPps* _srs_pps_snack2;
|
|||
extern SrsPps* _srs_pps_snack3;
|
||||
extern SrsPps* _srs_pps_snack4;
|
||||
|
||||
SrsPps* _srs_pps_aloss2 = new SrsPps();
|
||||
SrsPps* _srs_pps_aloss2 = NULL;
|
||||
|
||||
extern SrsPps* _srs_pps_ids;
|
||||
extern SrsPps* _srs_pps_fids;
|
||||
extern SrsPps* _srs_pps_fids_level0;
|
||||
extern SrsPps* _srs_pps_dispose;
|
||||
|
||||
extern SrsPps* _srs_pps_timer;
|
||||
|
||||
extern SrsPps* _srs_pps_snack;
|
||||
extern SrsPps* _srs_pps_snack2;
|
||||
extern SrsPps* _srs_pps_snack3;
|
||||
extern SrsPps* _srs_pps_snack4;
|
||||
extern SrsPps* _srs_pps_sanack;
|
||||
extern SrsPps* _srs_pps_svnack;
|
||||
|
||||
extern SrsPps* _srs_pps_rnack;
|
||||
extern SrsPps* _srs_pps_rnack2;
|
||||
extern SrsPps* _srs_pps_rhnack;
|
||||
extern SrsPps* _srs_pps_rmnack;
|
||||
|
||||
#if defined(SRS_DEBUG) && defined(SRS_DEBUG_STATS)
|
||||
extern SrsPps* _srs_pps_recvfrom;
|
||||
extern SrsPps* _srs_pps_recvfrom_eagain;
|
||||
extern SrsPps* _srs_pps_sendto;
|
||||
extern SrsPps* _srs_pps_sendto_eagain;
|
||||
|
||||
extern SrsPps* _srs_pps_read;
|
||||
extern SrsPps* _srs_pps_read_eagain;
|
||||
extern SrsPps* _srs_pps_readv;
|
||||
extern SrsPps* _srs_pps_readv_eagain;
|
||||
extern SrsPps* _srs_pps_writev;
|
||||
extern SrsPps* _srs_pps_writev_eagain;
|
||||
|
||||
extern SrsPps* _srs_pps_recvmsg;
|
||||
extern SrsPps* _srs_pps_recvmsg_eagain;
|
||||
extern SrsPps* _srs_pps_sendmsg;
|
||||
extern SrsPps* _srs_pps_sendmsg_eagain;
|
||||
|
||||
extern SrsPps* _srs_pps_epoll;
|
||||
extern SrsPps* _srs_pps_epoll_zero;
|
||||
extern SrsPps* _srs_pps_epoll_shake;
|
||||
extern SrsPps* _srs_pps_epoll_spin;
|
||||
|
||||
extern SrsPps* _srs_pps_sched_15ms;
|
||||
extern SrsPps* _srs_pps_sched_20ms;
|
||||
extern SrsPps* _srs_pps_sched_25ms;
|
||||
extern SrsPps* _srs_pps_sched_30ms;
|
||||
extern SrsPps* _srs_pps_sched_35ms;
|
||||
extern SrsPps* _srs_pps_sched_40ms;
|
||||
extern SrsPps* _srs_pps_sched_80ms;
|
||||
extern SrsPps* _srs_pps_sched_160ms;
|
||||
extern SrsPps* _srs_pps_sched_s;
|
||||
#endif
|
||||
|
||||
extern SrsPps* _srs_pps_clock_15ms;
|
||||
extern SrsPps* _srs_pps_clock_20ms;
|
||||
extern SrsPps* _srs_pps_clock_25ms;
|
||||
extern SrsPps* _srs_pps_clock_30ms;
|
||||
extern SrsPps* _srs_pps_clock_35ms;
|
||||
extern SrsPps* _srs_pps_clock_40ms;
|
||||
extern SrsPps* _srs_pps_clock_80ms;
|
||||
extern SrsPps* _srs_pps_clock_160ms;
|
||||
extern SrsPps* _srs_pps_timer_s;
|
||||
|
||||
#if defined(SRS_DEBUG) && defined(SRS_DEBUG_STATS)
|
||||
extern SrsPps* _srs_pps_thread_run;
|
||||
extern SrsPps* _srs_pps_thread_idle;
|
||||
extern SrsPps* _srs_pps_thread_yield;
|
||||
extern SrsPps* _srs_pps_thread_yield2;
|
||||
#endif
|
||||
|
||||
extern SrsPps* _srs_pps_rpkts;
|
||||
extern SrsPps* _srs_pps_addrs;
|
||||
extern SrsPps* _srs_pps_fast_addrs;
|
||||
|
||||
extern SrsPps* _srs_pps_spkts;
|
||||
|
||||
extern SrsPps* _srs_pps_sstuns;
|
||||
extern SrsPps* _srs_pps_srtcps;
|
||||
extern SrsPps* _srs_pps_srtps;
|
||||
|
||||
extern SrsPps* _srs_pps_pli;
|
||||
extern SrsPps* _srs_pps_twcc;
|
||||
extern SrsPps* _srs_pps_rr;
|
||||
extern SrsPps* _srs_pps_pub;
|
||||
extern SrsPps* _srs_pps_conn;
|
||||
|
||||
extern SrsPps* _srs_pps_rstuns;
|
||||
extern SrsPps* _srs_pps_rrtps;
|
||||
extern SrsPps* _srs_pps_rrtcps;
|
||||
|
||||
extern SrsPps* _srs_pps_aloss2;
|
||||
|
||||
extern SrsPps* _srs_pps_cids_get;
|
||||
extern SrsPps* _srs_pps_cids_set;
|
||||
|
||||
extern SrsPps* _srs_pps_objs_msgs;
|
||||
|
||||
extern SrsPps* _srs_pps_objs_rtps;
|
||||
extern SrsPps* _srs_pps_objs_rraw;
|
||||
extern SrsPps* _srs_pps_objs_rfua;
|
||||
extern SrsPps* _srs_pps_objs_rbuf;
|
||||
extern SrsPps* _srs_pps_objs_rothers;
|
||||
extern SrsPps* _srs_pps_objs_drop;
|
||||
|
||||
SrsCircuitBreaker::SrsCircuitBreaker()
|
||||
{
|
||||
|
@ -151,13 +255,123 @@ srs_error_t srs_thread_initialize()
|
|||
{
|
||||
srs_error_t err = srs_success;
|
||||
|
||||
// init st
|
||||
// The clock wall object.
|
||||
_srs_clock = new SrsWallClock();
|
||||
|
||||
// The pps cids depends by st init.
|
||||
_srs_pps_cids_get = new SrsPps();
|
||||
_srs_pps_cids_set = new SrsPps();
|
||||
|
||||
// Initialize ST, which depends on pps cids.
|
||||
if ((err = srs_st_init()) != srs_success) {
|
||||
return srs_error_wrap(err, "initialize st failed");
|
||||
}
|
||||
|
||||
// The global hybrid server.
|
||||
_srs_hybrid = new SrsHybridServer();
|
||||
|
||||
// Initialize global pps, which depends on _srs_clock
|
||||
_srs_pps_ids = new SrsPps();
|
||||
_srs_pps_fids = new SrsPps();
|
||||
_srs_pps_fids_level0 = new SrsPps();
|
||||
_srs_pps_dispose = new SrsPps();
|
||||
|
||||
_srs_pps_timer = new SrsPps();
|
||||
|
||||
_srs_pps_snack = new SrsPps();
|
||||
_srs_pps_snack2 = new SrsPps();
|
||||
_srs_pps_snack3 = new SrsPps();
|
||||
_srs_pps_snack4 = new SrsPps();
|
||||
_srs_pps_sanack = new SrsPps();
|
||||
_srs_pps_svnack = new SrsPps();
|
||||
|
||||
_srs_pps_rnack = new SrsPps();
|
||||
_srs_pps_rnack2 = new SrsPps();
|
||||
_srs_pps_rhnack = new SrsPps();
|
||||
_srs_pps_rmnack = new SrsPps();
|
||||
|
||||
#if defined(SRS_DEBUG) && defined(SRS_DEBUG_STATS)
|
||||
_srs_pps_recvfrom = new SrsPps();
|
||||
_srs_pps_recvfrom_eagain = new SrsPps();
|
||||
_srs_pps_sendto = new SrsPps();
|
||||
_srs_pps_sendto_eagain = new SrsPps();
|
||||
|
||||
_srs_pps_read = new SrsPps();
|
||||
_srs_pps_read_eagain = new SrsPps();
|
||||
_srs_pps_readv = new SrsPps();
|
||||
_srs_pps_readv_eagain = new SrsPps();
|
||||
_srs_pps_writev = new SrsPps();
|
||||
_srs_pps_writev_eagain = new SrsPps();
|
||||
|
||||
_srs_pps_recvmsg = new SrsPps();
|
||||
_srs_pps_recvmsg_eagain = new SrsPps();
|
||||
_srs_pps_sendmsg = new SrsPps();
|
||||
_srs_pps_sendmsg_eagain = new SrsPps();
|
||||
|
||||
_srs_pps_epoll = new SrsPps();
|
||||
_srs_pps_epoll_zero = new SrsPps();
|
||||
_srs_pps_epoll_shake = new SrsPps();
|
||||
_srs_pps_epoll_spin = new SrsPps();
|
||||
|
||||
_srs_pps_sched_15ms = new SrsPps();
|
||||
_srs_pps_sched_20ms = new SrsPps();
|
||||
_srs_pps_sched_25ms = new SrsPps();
|
||||
_srs_pps_sched_30ms = new SrsPps();
|
||||
_srs_pps_sched_35ms = new SrsPps();
|
||||
_srs_pps_sched_40ms = new SrsPps();
|
||||
_srs_pps_sched_80ms = new SrsPps();
|
||||
_srs_pps_sched_160ms = new SrsPps();
|
||||
_srs_pps_sched_s = new SrsPps();
|
||||
#endif
|
||||
|
||||
_srs_pps_clock_15ms = new SrsPps();
|
||||
_srs_pps_clock_20ms = new SrsPps();
|
||||
_srs_pps_clock_25ms = new SrsPps();
|
||||
_srs_pps_clock_30ms = new SrsPps();
|
||||
_srs_pps_clock_35ms = new SrsPps();
|
||||
_srs_pps_clock_40ms = new SrsPps();
|
||||
_srs_pps_clock_80ms = new SrsPps();
|
||||
_srs_pps_clock_160ms = new SrsPps();
|
||||
_srs_pps_timer_s = new SrsPps();
|
||||
|
||||
#if defined(SRS_DEBUG) && defined(SRS_DEBUG_STATS)
|
||||
_srs_pps_thread_run = new SrsPps();
|
||||
_srs_pps_thread_idle = new SrsPps();
|
||||
_srs_pps_thread_yield = new SrsPps();
|
||||
_srs_pps_thread_yield2 = new SrsPps();
|
||||
#endif
|
||||
|
||||
_srs_pps_rpkts = new SrsPps();
|
||||
_srs_pps_addrs = new SrsPps();
|
||||
_srs_pps_fast_addrs = new SrsPps();
|
||||
|
||||
_srs_pps_spkts = new SrsPps();
|
||||
|
||||
_srs_pps_sstuns = new SrsPps();
|
||||
_srs_pps_srtcps = new SrsPps();
|
||||
_srs_pps_srtps = new SrsPps();
|
||||
|
||||
_srs_pps_pli = new SrsPps();
|
||||
_srs_pps_twcc = new SrsPps();
|
||||
_srs_pps_rr = new SrsPps();
|
||||
_srs_pps_pub = new SrsPps();
|
||||
_srs_pps_conn = new SrsPps();
|
||||
|
||||
_srs_pps_rstuns = new SrsPps();
|
||||
_srs_pps_rrtps = new SrsPps();
|
||||
_srs_pps_rrtcps = new SrsPps();
|
||||
|
||||
_srs_pps_aloss2 = new SrsPps();
|
||||
|
||||
_srs_pps_objs_msgs = new SrsPps();
|
||||
|
||||
_srs_pps_objs_rtps = new SrsPps();
|
||||
_srs_pps_objs_rraw = new SrsPps();
|
||||
_srs_pps_objs_rfua = new SrsPps();
|
||||
_srs_pps_objs_rbuf = new SrsPps();
|
||||
_srs_pps_objs_rothers = new SrsPps();
|
||||
_srs_pps_objs_drop = new SrsPps();
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -92,7 +92,10 @@ srs_error_t do_main(int argc, char** argv)
|
|||
if ((err = srs_thread_initialize()) != srs_success) {
|
||||
return srs_error_wrap(err, "thread init");
|
||||
}
|
||||
|
||||
|
||||
// For background context id.
|
||||
_srs_context->set_id(_srs_context->generate_id());
|
||||
|
||||
// TODO: support both little and big endian.
|
||||
srs_assert(srs_is_little_endian());
|
||||
|
||||
|
@ -220,10 +223,8 @@ srs_error_t do_main(int argc, char** argv)
|
|||
return err;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
// For background context id.
|
||||
_srs_context->set_id(_srs_context->generate_id());
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
srs_error_t err = do_main(argc, argv);
|
||||
|
||||
if (err != srs_success) {
|
||||
|
|
|
@ -35,8 +35,8 @@ using namespace std;
|
|||
|
||||
#include <srs_protocol_kbps.hpp>
|
||||
|
||||
SrsPps* _srs_pps_cids_get = new SrsPps();
|
||||
SrsPps* _srs_pps_cids_set = new SrsPps();
|
||||
SrsPps* _srs_pps_cids_get = NULL;
|
||||
SrsPps* _srs_pps_cids_set = NULL;
|
||||
|
||||
#define SRS_BASIC_LOG_SIZE 8192
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue