Skip to content

Commit

Permalink
SRT: Initialize SRT eventloop in adapter.
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Jun 14, 2022
1 parent 4899be9 commit 21899c5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
15 changes: 15 additions & 0 deletions trunk/src/app/srs_app_srt_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
}

Expand Down
11 changes: 0 additions & 11 deletions trunk/src/main/srs_main_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 21899c5

Please sign in to comment.