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:
parent
ee1d06c613
commit
a357c013cd
6 changed files with 167 additions and 178 deletions
|
@ -34,6 +34,7 @@
|
|||
#include <srs_app_reload.hpp>
|
||||
#include <srs_core_performance.hpp>
|
||||
#include <srs_service_st.hpp>
|
||||
#include <srs_app_hourglass.hpp>
|
||||
|
||||
class SrsFormat;
|
||||
class SrsRtmpFormat;
|
||||
|
@ -450,15 +451,17 @@ public:
|
|||
};
|
||||
|
||||
// The source manager to create and refresh all stream sources.
|
||||
class SrsSourceManager
|
||||
class SrsSourceManager : public ISrsHourGlass
|
||||
{
|
||||
private:
|
||||
srs_mutex_t lock;
|
||||
std::map<std::string, SrsSource*> pool;
|
||||
SrsHourGlass* timer_;
|
||||
public:
|
||||
SrsSourceManager();
|
||||
virtual ~SrsSourceManager();
|
||||
public:
|
||||
virtual srs_error_t initialize();
|
||||
// create source when fetch from cache failed.
|
||||
// @param r the client request.
|
||||
// @param h the event handler for source.
|
||||
|
@ -471,9 +474,10 @@ private:
|
|||
public:
|
||||
// dispose and cycle all sources.
|
||||
virtual void dispose();
|
||||
virtual srs_error_t cycle();
|
||||
// interface ISrsHourGlass
|
||||
private:
|
||||
virtual srs_error_t do_cycle();
|
||||
virtual srs_error_t setup_ticks();
|
||||
virtual srs_error_t notify(int event, srs_utime_t interval, srs_utime_t tick);
|
||||
public:
|
||||
// when system exit, destroy th`e sources,
|
||||
// For gmc to analysis mem leaks.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue