mirror of
				https://github.com/ossrs/srs.git
				synced 2025-03-09 15:49:59 +00:00 
			
		
		
		
	Disable simulator API by default.
This commit is contained in:
		
							parent
							
								
									fe01a504b6
								
							
						
					
					
						commit
						db503975fb
					
				
					 5 changed files with 18 additions and 0 deletions
				
			
		| 
						 | 
					@ -79,6 +79,12 @@ else
 | 
				
			||||||
    srs_undefine_macro "SRS_RTC" $SRS_AUTO_HEADERS_H
 | 
					    srs_undefine_macro "SRS_RTC" $SRS_AUTO_HEADERS_H
 | 
				
			||||||
fi
 | 
					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
 | 
					if [ $SRS_GB28181 = YES ]; then
 | 
				
			||||||
    srs_define_macro "SRS_GB28181" $SRS_AUTO_HEADERS_H
 | 
					    srs_define_macro "SRS_GB28181" $SRS_AUTO_HEADERS_H
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -80,6 +80,8 @@ SRS_VALGRIND=NO
 | 
				
			||||||
SRS_BUILD_TAG=
 | 
					SRS_BUILD_TAG=
 | 
				
			||||||
# Whether do "make clean" when configure.
 | 
					# Whether do "make clean" when configure.
 | 
				
			||||||
SRS_CLEAN=YES
 | 
					SRS_CLEAN=YES
 | 
				
			||||||
 | 
					# Whether enable RTC simulate API.
 | 
				
			||||||
 | 
					SRS_SIMULATOR=NO
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
################################################################
 | 
					################################################################
 | 
				
			||||||
# presets
 | 
					# presets
 | 
				
			||||||
| 
						 | 
					@ -200,6 +202,7 @@ Experts:
 | 
				
			||||||
  --without-clean                   Configure SRS and never make clean even possible.
 | 
					  --without-clean                   Configure SRS and never make clean even possible.
 | 
				
			||||||
  --detect-sendmmsg=on|off          Whether detect the sendmmsg API.
 | 
					  --detect-sendmmsg=on|off          Whether detect the sendmmsg API.
 | 
				
			||||||
  --has-sendmmsg=on|off             Whether OS supports sendmmsg API.
 | 
					  --has-sendmmsg=on|off             Whether OS supports sendmmsg API.
 | 
				
			||||||
 | 
					  --simulator=on|off                Whether enable RTC network simulator.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Workflow:
 | 
					Workflow:
 | 
				
			||||||
  1. Apply "Presets". if not specified, use default preset.
 | 
					  1. Apply "Presets". if not specified, use default preset.
 | 
				
			||||||
| 
						 | 
					@ -315,6 +318,7 @@ function parse_user_option() {
 | 
				
			||||||
        --with-rtc)                     SRS_RTC=YES                 ;;
 | 
					        --with-rtc)                     SRS_RTC=YES                 ;;
 | 
				
			||||||
        --without-rtc)                  SRS_RTC=NO                  ;;
 | 
					        --without-rtc)                  SRS_RTC=NO                  ;;
 | 
				
			||||||
        --rtc)                          if [[ $value == off ]]; then SRS_RTC=NO; else SRS_RTC=YES; fi    ;;
 | 
					        --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             ;;
 | 
					        --with-gb28181)                 SRS_GB28181=YES             ;;
 | 
				
			||||||
        --without-gb28181)              SRS_GB28181=NO              ;;
 | 
					        --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_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_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_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_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_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
 | 
					    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
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1492,6 +1492,7 @@ srs_error_t SrsGoApiRtcPublish::exchange_sdp(SrsRequest* req, const SrsSdp& remo
 | 
				
			||||||
    return err;
 | 
					    return err;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef SRS_SIMULATOR
 | 
				
			||||||
SrsGoApiRtcNACK::SrsGoApiRtcNACK(SrsRtcServer* server)
 | 
					SrsGoApiRtcNACK::SrsGoApiRtcNACK(SrsRtcServer* server)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    server_ = server;
 | 
					    server_ = server;
 | 
				
			||||||
| 
						 | 
					@ -1549,6 +1550,7 @@ srs_error_t SrsGoApiRtcNACK::do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMe
 | 
				
			||||||
    return srs_success;
 | 
					    return srs_success;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SrsGoApiClients::SrsGoApiClients()
 | 
					SrsGoApiClients::SrsGoApiClients()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -203,6 +203,7 @@ private:
 | 
				
			||||||
    srs_error_t check_remote_sdp(const SrsSdp& remote_sdp);
 | 
					    srs_error_t check_remote_sdp(const SrsSdp& remote_sdp);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef SRS_SIMULATOR
 | 
				
			||||||
class SrsGoApiRtcNACK : public ISrsHttpHandler
 | 
					class SrsGoApiRtcNACK : public ISrsHttpHandler
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
| 
						 | 
					@ -216,6 +217,7 @@ private:
 | 
				
			||||||
    virtual srs_error_t do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r, SrsJsonObject* res);
 | 
					    virtual srs_error_t do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r, SrsJsonObject* res);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class SrsGoApiClients : public ISrsHttpHandler
 | 
					class SrsGoApiClients : public ISrsHttpHandler
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3397,9 +3397,12 @@ srs_error_t SrsRtcServer::listen_api()
 | 
				
			||||||
    if ((err = http_api_mux->handle("/rtc/v1/publish/", new SrsGoApiRtcPublish(this))) != srs_success) {
 | 
					    if ((err = http_api_mux->handle("/rtc/v1/publish/", new SrsGoApiRtcPublish(this))) != srs_success) {
 | 
				
			||||||
        return srs_error_wrap(err, "handle publish");
 | 
					        return srs_error_wrap(err, "handle publish");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef SRS_SIMULATOR
 | 
				
			||||||
    if ((err = http_api_mux->handle("/rtc/v1/nack/", new SrsGoApiRtcNACK(this))) != srs_success) {
 | 
					    if ((err = http_api_mux->handle("/rtc/v1/nack/", new SrsGoApiRtcNACK(this))) != srs_success) {
 | 
				
			||||||
        return srs_error_wrap(err, "handle nack");
 | 
					        return srs_error_wrap(err, "handle nack");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return err;
 | 
					    return err;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue