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

Refine SRT code, with StateThread adpater

This commit is contained in:
hondaxiao 2022-04-15 13:54:24 +08:00 committed by winlin
parent 3ed4aed824
commit 94fa0ff7bd
25 changed files with 4131 additions and 68 deletions

View file

@ -44,7 +44,8 @@ using namespace std;
#endif
#ifdef SRS_SRT
#include <srt_server.hpp>
#include <srs_service_st_srt.hpp>
#include <srs_app_srt_server.hpp>
#endif
// pre-declare
@ -65,6 +66,10 @@ 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.
*/
@ -455,7 +460,14 @@ srs_error_t run_hybrid_server()
_srs_hybrid->register_server(new SrsServerAdapter());
#ifdef SRS_SRT
_srs_hybrid->register_server(new SrtServerAdapter());
_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
#ifdef SRS_RTC