1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-13 03:41:55 +00:00

Refine init of global objects

This commit is contained in:
winlin 2021-05-08 11:29:19 +08:00
parent 8b58d18a5a
commit 4cf6da107c
2 changed files with 12 additions and 3 deletions

View file

@ -37,6 +37,10 @@
#include <string>
using namespace std;
extern ISrsLog* _srs_log;
extern ISrsContext* _srs_context;
extern SrsConfig* _srs_config;
extern SrsStageManager* _srs_stages;
extern SrsRtcBlackhole* _srs_blackhole;
extern SrsResourceManager* _srs_rtc_manager;
@ -275,6 +279,11 @@ srs_error_t srs_thread_initialize()
{
srs_error_t err = srs_success;
// Root global objects.
_srs_log = new SrsFileLog();
_srs_context = new SrsThreadContext();
_srs_config = new SrsConfig();
// The clock wall object.
_srs_clock = new SrsWallClock();

View file

@ -70,10 +70,10 @@ srs_error_t run_hybrid_server();
void show_macro_features();
// @global log and context.
ISrsLog* _srs_log = new SrsFileLog();
ISrsContext* _srs_context = new SrsThreadContext();
ISrsLog* _srs_log = NULL;
ISrsContext* _srs_context = NULL;
// @global config object for app module.
SrsConfig* _srs_config = new SrsConfig();
SrsConfig* _srs_config = NULL;
// @global version of srs, which can grep keyword "XCORE"
extern const char* _srs_version;