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

@ -17,6 +17,10 @@
#include <string>
using namespace std;
#ifdef SRS_SRT
#include <srs_app_srt_server.hpp>
#endif
// Temporary disk config.
std::string _srs_tmp_file_prefix = "/tmp/srs-utest-";
// Temporary network config.
@ -32,6 +36,10 @@ SrsConfig* _srs_config = NULL;
SrsServer* _srs_server = NULL;
bool _srs_in_docker = false;
#ifdef SRS_SRT
SrsSrtEventLoop* _srt_eventloop = NULL;
#endif
#include <srs_app_st.hpp>
// Initialize global settings.
@ -52,6 +60,16 @@ srs_error_t prepare_main() {
srs_freep(_srs_context);
_srs_context = new SrsThreadContext();
#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");
}
#endif
return err;
}