1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-13 11:51:57 +00:00

SRT: Initialize SRT eventloop in adapter.

This commit is contained in:
winlin 2022-05-28 12:07:36 +08:00
parent 4899be9c34
commit 21899c5998
2 changed files with 15 additions and 11 deletions

View file

@ -14,6 +14,10 @@ using namespace std;
#include <srs_app_config.hpp>
#include <srs_app_srt_conn.hpp>
#ifdef SRS_SRT
SrsSrtEventLoop* _srt_eventloop = NULL;
#endif
std::string srs_srt_listener_type2string(SrsSrtListenerType type)
{
switch (type) {
@ -300,6 +304,17 @@ SrsSrtServerAdapter::~SrsSrtServerAdapter()
srs_error_t SrsSrtServerAdapter::initialize()
{
srs_error_t err = srs_success;
_srt_eventloop = new SrsSrtEventLoop();
if ((err = _srt_eventloop->initialize()) != srs_success) {
return srs_error_wrap(err, "srt poller initialize");
}
if ((err = _srt_eventloop->start()) != srs_success) {
return srs_error_wrap(err, "srt poller start");
}
return err;
}

View file

@ -66,10 +66,6 @@ extern const char* _srs_version;
// @global main SRS server, for debugging
SrsServer* _srs_server = NULL;
#ifdef SRS_SRT
SrsSrtEventLoop* _srt_eventloop = NULL;
#endif
/**
* main entrance.
*/
@ -460,13 +456,6 @@ srs_error_t run_hybrid_server()
_srs_hybrid->register_server(new SrsServerAdapter());
#ifdef SRS_SRT
_srt_eventloop = new SrsSrtEventLoop();
if ((err = _srt_eventloop->initialize()) != srs_success) {
return srs_error_wrap(err, "srt poller initialize");
}
if ((err = _srt_eventloop->start()) != srs_success) {
return srs_error_wrap(err, "srt poller start");
}
_srs_hybrid->register_server(new SrsSrtServerAdapter());
#endif