1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-02-13 03:41:55 +00:00

Disable simulator API by default.

This commit is contained in:
winlin 2020-05-07 16:29:11 +08:00
parent fe01a504b6
commit db503975fb
5 changed files with 18 additions and 0 deletions

View file

@ -79,6 +79,12 @@ else
srs_undefine_macro "SRS_RTC" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_SIMULATOR = YES ]; then
srs_define_macro "SRS_SIMULATOR" $SRS_AUTO_HEADERS_H
else
srs_undefine_macro "SRS_SIMULATOR" $SRS_AUTO_HEADERS_H
fi
if [ $SRS_GB28181 = YES ]; then
srs_define_macro "SRS_GB28181" $SRS_AUTO_HEADERS_H
else

View file

@ -80,6 +80,8 @@ SRS_VALGRIND=NO
SRS_BUILD_TAG=
# Whether do "make clean" when configure.
SRS_CLEAN=YES
# Whether enable RTC simulate API.
SRS_SIMULATOR=NO
#
################################################################
# presets
@ -200,6 +202,7 @@ Experts:
--without-clean Configure SRS and never make clean even possible.
--detect-sendmmsg=on|off Whether detect the sendmmsg API.
--has-sendmmsg=on|off Whether OS supports sendmmsg API.
--simulator=on|off Whether enable RTC network simulator.
Workflow:
1. Apply "Presets". if not specified, use default preset.
@ -315,6 +318,7 @@ function parse_user_option() {
--with-rtc) SRS_RTC=YES ;;
--without-rtc) SRS_RTC=NO ;;
--rtc) if [[ $value == off ]]; then SRS_RTC=NO; else SRS_RTC=YES; fi ;;
--simulator) if [[ $value == off ]]; then SRS_SIMULATOR=NO; else SRS_SIMULATOR=YES; fi ;;
--with-gb28181) SRS_GB28181=YES ;;
--without-gb28181) SRS_GB28181=NO ;;
@ -638,6 +642,7 @@ function regenerate_options() {
if [ $SRS_UTEST = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --utest=on"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --utest=off"; fi
if [ $SRS_SRT = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --srt=on"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --srt=off"; fi
if [ $SRS_RTC = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --rtc=on"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --rtc=off"; fi
if [ $SRS_SIMULATOR = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --simulator=on"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --simulator=off"; fi
if [ $SRS_GB28181 = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --gb28181=on"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --gb28181=off"; fi
if [ $SRS_NASM = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --nasm=on"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --nasm=off"; fi
if [ $SRS_SRTP_ASM = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --srtp-nasm=on"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --srtp-nasm=off"; fi

View file

@ -1492,6 +1492,7 @@ srs_error_t SrsGoApiRtcPublish::exchange_sdp(SrsRequest* req, const SrsSdp& remo
return err;
}
#ifdef SRS_SIMULATOR
SrsGoApiRtcNACK::SrsGoApiRtcNACK(SrsRtcServer* server)
{
server_ = server;
@ -1549,6 +1550,7 @@ srs_error_t SrsGoApiRtcNACK::do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMe
return srs_success;
}
#endif
#endif
SrsGoApiClients::SrsGoApiClients()
{

View file

@ -203,6 +203,7 @@ private:
srs_error_t check_remote_sdp(const SrsSdp& remote_sdp);
};
#ifdef SRS_SIMULATOR
class SrsGoApiRtcNACK : public ISrsHttpHandler
{
private:
@ -216,6 +217,7 @@ private:
virtual srs_error_t do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r, SrsJsonObject* res);
};
#endif
#endif
class SrsGoApiClients : public ISrsHttpHandler
{

View file

@ -3397,9 +3397,12 @@ srs_error_t SrsRtcServer::listen_api()
if ((err = http_api_mux->handle("/rtc/v1/publish/", new SrsGoApiRtcPublish(this))) != srs_success) {
return srs_error_wrap(err, "handle publish");
}
#ifdef SRS_SIMULATOR
if ((err = http_api_mux->handle("/rtc/v1/nack/", new SrsGoApiRtcNACK(this))) != srs_success) {
return srs_error_wrap(err, "handle nack");
}
#endif
return err;
}