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

Timer: Apply timer(HourGlass) to server and sources

This commit is contained in:
winlin 2021-02-09 17:15:25 +08:00
parent ee1d06c613
commit a357c013cd
6 changed files with 167 additions and 178 deletions

View file

@ -38,6 +38,7 @@
#include <srs_service_st.hpp>
#include <srs_app_gb28181.hpp>
#include <srs_app_gb28181_sip.hpp>
#include <srs_app_hourglass.hpp>
class SrsServer;
class SrsHttpServeMux;
@ -262,6 +263,7 @@ public:
// SRS RTMP server, initialize and listen, start connection service thread, destroy client.
class SrsServer : virtual public ISrsReloadHandler, virtual public ISrsSourceHandler
, virtual public ISrsResourceManager, virtual public ISrsCoroutineHandler
, virtual public ISrsHourGlass
{
private:
// TODO: FIXME: Extract an HttpApiServer.
@ -271,6 +273,7 @@ private:
SrsIngester* ingester;
SrsResourceManager* conn_manager;
SrsCoroutine* trd_;
SrsHourGlass* timer_;
private:
// The pid file fd, lock the file write when server is running.
// @remark the init.d script should cleanup the pid file, when stop service,
@ -342,6 +345,11 @@ private:
// update the global static data, for instance, the current time,
// the cpu/mem/network statistic.
virtual srs_error_t do_cycle();
// interface ISrsHourGlass
private:
virtual srs_error_t setup_ticks();
virtual srs_error_t notify(int event, srs_utime_t interval, srs_utime_t tick);
private:
// listen at specified protocol.
virtual srs_error_t listen_rtmp();
virtual srs_error_t listen_http_api();