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

Use macro to disable SRT in code

This commit is contained in:
winlin 2020-01-23 14:23:09 +08:00
parent fb29096505
commit f143757429
4 changed files with 17 additions and 3 deletions

View file

@ -70,6 +70,12 @@ else
srs_undefine_macro "SRS_AUTO_HDS" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_SRT = YES ]; then
srs_define_macro "SRS_AUTO_SRT" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_AUTO_SRT" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_MEM_WATCH = YES ]; then
srs_define_macro "SRS_AUTO_MEM_WATCH" $SRS_AUTO_HEADERS_H
else

View file

@ -688,9 +688,11 @@ srs_error_t SrsServer::listen()
if ((err = conn_manager->start()) != srs_success) {
return srs_error_wrap(err, "connection manager");
}
#ifdef SRS_AUTO_SRT
if ((err = listen_srt()) != srs_success) {
return srs_error_wrap(err, "srt listen");
}
#endif
return err;
}
@ -1007,6 +1009,7 @@ srs_error_t SrsServer::do_cycle()
return err;
}
#ifdef SRS_AUTO_SRT
srs_error_t SrsServer::listen_srt() {
srs_error_t err = srs_success;
@ -1030,6 +1033,7 @@ srs_error_t SrsServer::listen_srt() {
}
return err;
}
#endif
srs_error_t SrsServer::listen_rtmp()
{

View file

@ -36,8 +36,10 @@
#include <srs_app_listener.hpp>
#include <srs_app_conn.hpp>
#include <srs_service_st.hpp>
#ifdef SRS_AUTO_SRT
#include "../srt/srt_server.hpp"
#include "../srt/srt_to_rtmp.hpp"
#endif
class SrsServer;
class SrsConnection;
@ -211,11 +213,10 @@ private:
SrsHttpHeartbeat* http_heartbeat;
SrsIngester* ingester;
SrsCoroutineManager* conn_manager;
private:
#ifdef SRS_AUTO_SRT
//srt server
SRT_SERVER_PTR srt_ptr;
#endif
private:
// The pid file fd, lock the file write when server is running.
// @remark the init.d script should cleanup the pid file, when stop service,
@ -286,8 +287,10 @@ private:
virtual srs_error_t listen_http_api();
virtual srs_error_t listen_http_stream();
virtual srs_error_t listen_stream_caster();
#ifdef SRS_AUTO_SRT
//start listen srt udp port
virtual srs_error_t listen_srt();
#endif
// Close the listeners for specified type,
// Remove the listen object from manager.
virtual void close_listeners(SrsListenerType type);

View file

@ -214,6 +214,7 @@ void show_macro_features()
ss << ", dash:" << "on";
ss << ", hls:" << srs_bool2switch(true);
ss << ", hds:" << srs_bool2switch(SRS_AUTO_HDS_BOOL);
ss << ", srt:" << srs_bool2switch(SRS_AUTO_SRT_BOOL);
// hc(http callback)
ss << ", hc:" << srs_bool2switch(true);
// ha(http api)