mirror of
				https://github.com/ossrs/srs.git
				synced 2025-03-09 15:49:59 +00:00 
			
		
		
		
	RTC: Support build without RTMP2RTC bridger, no FFmpeg fit.
This commit is contained in:
		
							parent
							
								
									ab6bc39676
								
							
						
					
					
						commit
						be5d76009e
					
				
					 7 changed files with 117 additions and 19 deletions
				
			
		| 
						 | 
					@ -87,6 +87,12 @@ else
 | 
				
			||||||
    srs_undefine_macro "SRS_RTC" $SRS_AUTO_HEADERS_H
 | 
					    srs_undefine_macro "SRS_RTC" $SRS_AUTO_HEADERS_H
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					if [ $SRS_FFMPEG_FIT = YES ]; then
 | 
				
			||||||
 | 
					    srs_define_macro "SRS_FFMPEG_FIT" $SRS_AUTO_HEADERS_H
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					    srs_undefine_macro "SRS_FFMPEG_FIT" $SRS_AUTO_HEADERS_H
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ $SRS_SIMULATOR = YES ]; then
 | 
					if [ $SRS_SIMULATOR = YES ]; then
 | 
				
			||||||
    srs_define_macro "SRS_SIMULATOR" $SRS_AUTO_HEADERS_H
 | 
					    srs_define_macro "SRS_SIMULATOR" $SRS_AUTO_HEADERS_H
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -595,7 +595,7 @@ fi
 | 
				
			||||||
#####################################################################################
 | 
					#####################################################################################
 | 
				
			||||||
# ffmpeg-fix, for WebRTC to transcode AAC with Opus.
 | 
					# ffmpeg-fix, for WebRTC to transcode AAC with Opus.
 | 
				
			||||||
#####################################################################################
 | 
					#####################################################################################
 | 
				
			||||||
if [[ $SRS_RTC == YES ]]; then
 | 
					if [[ $SRS_FFMPEG_FIT == YES ]]; then
 | 
				
			||||||
    FFMPEG_OPTIONS=""
 | 
					    FFMPEG_OPTIONS=""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # If disable nasm, disable all ASMs.
 | 
					    # If disable nasm, disable all ASMs.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -22,7 +22,6 @@ SRS_GB28181=NO
 | 
				
			||||||
SRS_CXX11=NO
 | 
					SRS_CXX11=NO
 | 
				
			||||||
SRS_CXX14=NO
 | 
					SRS_CXX14=NO
 | 
				
			||||||
SRS_NGINX=NO
 | 
					SRS_NGINX=NO
 | 
				
			||||||
SRS_FFMPEG_TOOL=NO
 | 
					 | 
				
			||||||
SRS_LIBRTMP=NO
 | 
					SRS_LIBRTMP=NO
 | 
				
			||||||
SRS_RESEARCH=NO
 | 
					SRS_RESEARCH=NO
 | 
				
			||||||
SRS_UTEST=NO
 | 
					SRS_UTEST=NO
 | 
				
			||||||
| 
						 | 
					@ -46,8 +45,12 @@ SRS_HLS=YES
 | 
				
			||||||
SRS_DVR=YES
 | 
					SRS_DVR=YES
 | 
				
			||||||
# 
 | 
					# 
 | 
				
			||||||
################################################################
 | 
					################################################################
 | 
				
			||||||
# libraries
 | 
					# FFmpeg stub is the stub code in SRS for ingester or encoder.
 | 
				
			||||||
SRS_FFMPEG_STUB=NO
 | 
					SRS_FFMPEG_STUB=NO
 | 
				
			||||||
 | 
					# FFmpeg tool is the binary for FFmpeg tool, to exec ingest or transcode.
 | 
				
			||||||
 | 
					SRS_FFMPEG_TOOL=NO
 | 
				
			||||||
 | 
					# FFmpeg fit is the source code for RTC, to transcode audio or video in SRS.
 | 
				
			||||||
 | 
					SRS_FFMPEG_FIT=RESERVED
 | 
				
			||||||
# arguments
 | 
					# arguments
 | 
				
			||||||
SRS_PREFIX=/usr/local/srs
 | 
					SRS_PREFIX=/usr/local/srs
 | 
				
			||||||
SRS_JOBS=1
 | 
					SRS_JOBS=1
 | 
				
			||||||
| 
						 | 
					@ -153,6 +156,7 @@ Features:
 | 
				
			||||||
  --gb28181=on|off          Whether build the GB28181 support for SRS.
 | 
					  --gb28181=on|off          Whether build the GB28181 support for SRS.
 | 
				
			||||||
  --cxx11=on|off            Whether enable the C++11 support for SRS.
 | 
					  --cxx11=on|off            Whether enable the C++11 support for SRS.
 | 
				
			||||||
  --cxx14=on|off            Whether enable the C++14 support for SRS.
 | 
					  --cxx14=on|off            Whether enable the C++14 support for SRS.
 | 
				
			||||||
 | 
					  --ffmpeg-fit=on|off       Whether enable the FFmpeg fit(source code) for SRS.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  --prefix=<path>           The absolute installation path for srs. Default: $SRS_PREFIX
 | 
					  --prefix=<path>           The absolute installation path for srs. Default: $SRS_PREFIX
 | 
				
			||||||
  --gcov=on|off             Whether enable the GCOV compiler options.
 | 
					  --gcov=on|off             Whether enable the GCOV compiler options.
 | 
				
			||||||
| 
						 | 
					@ -282,7 +286,7 @@ function parse_user_option() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        --with-ffmpeg)                  SRS_FFMPEG_TOOL=YES         ;;
 | 
					        --with-ffmpeg)                  SRS_FFMPEG_TOOL=YES         ;;
 | 
				
			||||||
        --without-ffmpeg)               SRS_FFMPEG_TOOL=NO          ;;
 | 
					        --without-ffmpeg)               SRS_FFMPEG_TOOL=NO          ;;
 | 
				
			||||||
        --ffmpeg)                       if [[ $value == off ]]; then SRS_FFMPEG_TOOL=NO; else SRS_FFMPEG_TOOL=YES; fi    ;;
 | 
					        --ffmpeg-tool)                  if [[ $value == off ]]; then SRS_FFMPEG_TOOL=NO; else SRS_FFMPEG_TOOL=YES; fi    ;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        --with-transcode)               SRS_TRANSCODE=YES           ;;
 | 
					        --with-transcode)               SRS_TRANSCODE=YES           ;;
 | 
				
			||||||
        --without-transcode)            echo "ignore option \"$option\"" ;;
 | 
					        --without-transcode)            echo "ignore option \"$option\"" ;;
 | 
				
			||||||
| 
						 | 
					@ -327,6 +331,7 @@ function parse_user_option() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        --cxx11)                        if [[ $value == off ]]; then SRS_CXX11=NO; else SRS_CXX11=YES; fi    ;;
 | 
					        --cxx11)                        if [[ $value == off ]]; then SRS_CXX11=NO; else SRS_CXX11=YES; fi    ;;
 | 
				
			||||||
        --cxx14)                        if [[ $value == off ]]; then SRS_CXX14=NO; else SRS_CXX14=YES; fi    ;;
 | 
					        --cxx14)                        if [[ $value == off ]]; then SRS_CXX14=NO; else SRS_CXX14=YES; fi    ;;
 | 
				
			||||||
 | 
					        --ffmpeg-fit)                   if [[ $value == off ]]; then SRS_FFMPEG_FIT=NO; else SRS_FFMPEG_FIT=YES; fi    ;;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        --with-clean)                   SRS_CLEAN=YES               ;;
 | 
					        --with-clean)                   SRS_CLEAN=YES               ;;
 | 
				
			||||||
        --without-clean)                SRS_CLEAN=NO                ;;
 | 
					        --without-clean)                SRS_CLEAN=NO                ;;
 | 
				
			||||||
| 
						 | 
					@ -526,6 +531,11 @@ function apply_user_presets() {
 | 
				
			||||||
    if [[ $SRS_SRT == YES ]]; then
 | 
					    if [[ $SRS_SRT == YES ]]; then
 | 
				
			||||||
        SRS_CXX11=YES
 | 
					        SRS_CXX11=YES
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    # Enable FFmpeg fit for RTC to trancode audio from AAC to OPUS, if user has't disabled it.
 | 
				
			||||||
 | 
					    if [[ $SRS_RTC == YES && $SRS_FFMPEG_FIT == RESERVED ]]; then
 | 
				
			||||||
 | 
					        SRS_FFMPEG_FIT=YES
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
apply_user_presets
 | 
					apply_user_presets
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -625,8 +635,9 @@ function regenerate_options() {
 | 
				
			||||||
    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_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_CXX11 = YES ]; then           SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cxx11=on"; else         SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cxx11=off"; fi
 | 
					    if [ $SRS_CXX11 = YES ]; then           SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cxx11=on"; else           SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cxx11=off"; fi
 | 
				
			||||||
    if [ $SRS_CXX14 = YES ]; then           SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cxx14=on"; else         SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cxx14=off"; fi
 | 
					    if [ $SRS_CXX14 = YES ]; then           SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cxx14=on"; else           SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cxx14=off"; fi
 | 
				
			||||||
 | 
					    if [ $SRS_FFMPEG_FIT = YES ]; then      SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --ffmpeg-fit=on"; else      SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --ffmpeg-fit=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
 | 
				
			||||||
    if [ $SRS_SENDMMSG = YES ]; then        SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --sendmmsg=on"; else        SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --sendmmsg=off"; fi
 | 
					    if [ $SRS_SENDMMSG = YES ]; then        SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --sendmmsg=on"; else        SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --sendmmsg=off"; fi
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										52
									
								
								trunk/configure
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										52
									
								
								trunk/configure
									
										
									
									
										vendored
									
									
								
							| 
						 | 
					@ -141,7 +141,7 @@ if [[ $SRS_RTC == YES ]]; then
 | 
				
			||||||
  LibSrtpRoot="${SRS_OBJS_DIR}/srtp2/include"; LibSrtpFile="${SRS_OBJS_DIR}/srtp2/lib/libsrtp2.a"
 | 
					  LibSrtpRoot="${SRS_OBJS_DIR}/srtp2/include"; LibSrtpFile="${SRS_OBJS_DIR}/srtp2/lib/libsrtp2.a"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
# FFMPEG for WebRTC transcoding, such as aac to opus.
 | 
					# FFMPEG for WebRTC transcoding, such as aac to opus.
 | 
				
			||||||
if [[ $SRS_RTC == YES ]]; then
 | 
					if [[ $SRS_FFMPEG_FIT == YES ]]; then
 | 
				
			||||||
  LibFfmpegRoot="${SRS_OBJS_DIR}/ffmpeg/include"; LibFfmpegFile="${SRS_OBJS_DIR}/ffmpeg/lib/libavcodec.a ${SRS_OBJS_DIR}/ffmpeg/lib/libswresample.a ${SRS_OBJS_DIR}/ffmpeg/lib/libavutil.a"
 | 
					  LibFfmpegRoot="${SRS_OBJS_DIR}/ffmpeg/include"; LibFfmpegFile="${SRS_OBJS_DIR}/ffmpeg/lib/libavcodec.a ${SRS_OBJS_DIR}/ffmpeg/lib/libswresample.a ${SRS_OBJS_DIR}/ffmpeg/lib/libavutil.a"
 | 
				
			||||||
  LibFfmpegRoot="${LibFfmpegRoot} ${SRS_OBJS_DIR}/opus/include"; LibFfmpegFile="${LibFfmpegFile} ${SRS_OBJS_DIR}/opus/lib/libopus.a"
 | 
					  LibFfmpegRoot="${LibFfmpegRoot} ${SRS_OBJS_DIR}/opus/include"; LibFfmpegFile="${LibFfmpegFile} ${SRS_OBJS_DIR}/opus/lib/libopus.a"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
| 
						 | 
					@ -222,7 +222,10 @@ MODULE_FILES=("srs_protocol_amf0" "srs_protocol_io" "srs_rtmp_stack"
 | 
				
			||||||
        "srs_service_rtmp_conn" "srs_service_utility" "srs_service_conn")
 | 
					        "srs_service_rtmp_conn" "srs_service_utility" "srs_service_conn")
 | 
				
			||||||
if [[ $SRS_RTC == YES ]]; then
 | 
					if [[ $SRS_RTC == YES ]]; then
 | 
				
			||||||
    MODULE_FILES+=("srs_rtc_stun_stack")
 | 
					    MODULE_FILES+=("srs_rtc_stun_stack")
 | 
				
			||||||
    ModuleLibIncs+=("${LibFfmpegRoot[*]}" ${LibSrtpRoot})
 | 
					    ModuleLibIncs+=(${LibSrtpRoot})
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					if [[ $SRS_FFMPEG_FIT == YES ]]; then
 | 
				
			||||||
 | 
					    ModuleLibIncs+=("${LibFfmpegRoot[*]}")
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
PROTOCOL_INCS="src/protocol"; MODULE_DIR=${PROTOCOL_INCS} . auto/modules.sh
 | 
					PROTOCOL_INCS="src/protocol"; MODULE_DIR=${PROTOCOL_INCS} . auto/modules.sh
 | 
				
			||||||
PROTOCOL_OBJS="${MODULE_OBJS[@]}"
 | 
					PROTOCOL_OBJS="${MODULE_OBJS[@]}"
 | 
				
			||||||
| 
						 | 
					@ -246,7 +249,10 @@ if [ $SRS_GPERF = YES ]; then
 | 
				
			||||||
    ModuleLibIncs+=(${LibGperfRoot})
 | 
					    ModuleLibIncs+=(${LibGperfRoot})
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
if [[ $SRS_RTC == YES ]]; then
 | 
					if [[ $SRS_RTC == YES ]]; then
 | 
				
			||||||
    ModuleLibIncs+=("${LibFfmpegRoot[*]}" ${LibSrtpRoot})
 | 
					    ModuleLibIncs+=(${LibSrtpRoot})
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					if [[ $SRS_FFMPEG_FIT == YES ]]; then
 | 
				
			||||||
 | 
					    ModuleLibIncs+=("${LibFfmpegRoot[*]}")
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
MODULE_FILES=("srs_app_server" "srs_app_conn" "srs_app_rtmp_conn" "srs_app_source"
 | 
					MODULE_FILES=("srs_app_server" "srs_app_conn" "srs_app_rtmp_conn" "srs_app_source"
 | 
				
			||||||
        "srs_app_refer" "srs_app_hls" "srs_app_forward" "srs_app_encoder" "srs_app_http_stream"
 | 
					        "srs_app_refer" "srs_app_hls" "srs_app_forward" "srs_app_encoder" "srs_app_http_stream"
 | 
				
			||||||
| 
						 | 
					@ -260,9 +266,12 @@ MODULE_FILES=("srs_app_server" "srs_app_conn" "srs_app_rtmp_conn" "srs_app_sourc
 | 
				
			||||||
        "srs_app_hourglass" "srs_app_dash" "srs_app_fragment" "srs_app_dvr"
 | 
					        "srs_app_hourglass" "srs_app_dash" "srs_app_fragment" "srs_app_dvr"
 | 
				
			||||||
        "srs_app_coworkers" "srs_app_hybrid")
 | 
					        "srs_app_coworkers" "srs_app_hybrid")
 | 
				
			||||||
if [[ $SRS_RTC == YES ]]; then
 | 
					if [[ $SRS_RTC == YES ]]; then
 | 
				
			||||||
    MODULE_FILES+=("srs_app_rtc_conn" "srs_app_rtc_dtls" "srs_app_rtc_codec" "srs_app_rtc_sdp"
 | 
					    MODULE_FILES+=("srs_app_rtc_conn" "srs_app_rtc_dtls" "srs_app_rtc_sdp"
 | 
				
			||||||
        "srs_app_rtc_queue" "srs_app_rtc_server" "srs_app_rtc_source" "srs_app_rtc_api")
 | 
					        "srs_app_rtc_queue" "srs_app_rtc_server" "srs_app_rtc_source" "srs_app_rtc_api")
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					if [[ $SRS_FFMPEG_FIT == YES ]]; then
 | 
				
			||||||
 | 
					    MODULE_FILES+=("srs_app_rtc_codec")
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
if [[ $SRS_GB28181 == YES ]]; then
 | 
					if [[ $SRS_GB28181 == YES ]]; then
 | 
				
			||||||
    MODULE_FILES+=("srs_app_gb28181" "srs_app_gb28181_sip" "srs_app_gb28181_jitbuffer")
 | 
					    MODULE_FILES+=("srs_app_gb28181" "srs_app_gb28181_sip" "srs_app_gb28181_jitbuffer")
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
| 
						 | 
					@ -284,7 +293,10 @@ if [[ $SRS_SRT == YES ]]; then
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
ModuleLibIncs=(${SRS_OBJS_DIR} ${LibSTRoot} ${LibGperfRoot} ${LibSSLRoot})
 | 
					ModuleLibIncs=(${SRS_OBJS_DIR} ${LibSTRoot} ${LibGperfRoot} ${LibSSLRoot})
 | 
				
			||||||
if [[ $SRS_RTC == YES ]]; then
 | 
					if [[ $SRS_RTC == YES ]]; then
 | 
				
			||||||
    ModuleLibIncs+=("${LibFfmpegRoot[*]}" ${LibSrtpRoot})
 | 
					    ModuleLibIncs+=(${LibSrtpRoot})
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					if [[ $SRS_FFMPEG_FIT == YES ]]; then
 | 
				
			||||||
 | 
					    ModuleLibIncs+=("${LibFfmpegRoot[*]}")
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
if [[ $SRS_SRT == YES ]]; then
 | 
					if [[ $SRS_SRT == YES ]]; then
 | 
				
			||||||
    ModuleLibIncs+=("${LibSRTRoot[*]}")
 | 
					    ModuleLibIncs+=("${LibSRTRoot[*]}")
 | 
				
			||||||
| 
						 | 
					@ -298,7 +310,10 @@ MODULE_ID="MAIN"
 | 
				
			||||||
MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL")
 | 
					MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL")
 | 
				
			||||||
ModuleLibIncs=(${SRS_OBJS_DIR} ${LibSTRoot} ${LibGperfRoot} ${LibSSLRoot})
 | 
					ModuleLibIncs=(${SRS_OBJS_DIR} ${LibSTRoot} ${LibGperfRoot} ${LibSSLRoot})
 | 
				
			||||||
if [[ $SRS_RTC == YES ]]; then
 | 
					if [[ $SRS_RTC == YES ]]; then
 | 
				
			||||||
    ModuleLibIncs+=("${LibFfmpegRoot[*]}" ${LibSrtpRoot})
 | 
					    ModuleLibIncs+=(${LibSrtpRoot})
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					if [[ $SRS_FFMPEG_FIT == YES ]]; then
 | 
				
			||||||
 | 
					    ModuleLibIncs+=("${LibFfmpegRoot[*]}")
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
MODULE_FILES=()
 | 
					MODULE_FILES=()
 | 
				
			||||||
DEFINES=""
 | 
					DEFINES=""
 | 
				
			||||||
| 
						 | 
					@ -325,7 +340,10 @@ done
 | 
				
			||||||
# all depends libraries
 | 
					# all depends libraries
 | 
				
			||||||
ModuleLibFiles=(${LibSTfile} ${LibSSLfile} ${LibGperfFile})
 | 
					ModuleLibFiles=(${LibSTfile} ${LibSSLfile} ${LibGperfFile})
 | 
				
			||||||
if [[ $SRS_RTC == YES ]]; then
 | 
					if [[ $SRS_RTC == YES ]]; then
 | 
				
			||||||
    ModuleLibFiles+=("${LibFfmpegFile[*]}" ${LibSrtpFile})
 | 
					    ModuleLibFiles+=(${LibSrtpFile})
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					if [[ $SRS_FFMPEG_FIT == YES ]]; then
 | 
				
			||||||
 | 
					    ModuleLibFiles+=("${LibFfmpegFile[*]}")
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
if [[ $SRS_SRT == YES ]]; then
 | 
					if [[ $SRS_SRT == YES ]]; then
 | 
				
			||||||
    ModuleLibFiles+=("${LibSRTfile[*]}")
 | 
					    ModuleLibFiles+=("${LibSRTfile[*]}")
 | 
				
			||||||
| 
						 | 
					@ -334,7 +352,10 @@ fi
 | 
				
			||||||
MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${PROTOCOL_OBJS[@]} ${APP_OBJS[@]} ${SERVER_OBJS[@]}"
 | 
					MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${PROTOCOL_OBJS[@]} ${APP_OBJS[@]} ${SERVER_OBJS[@]}"
 | 
				
			||||||
ModuleLibIncs=(${SRS_OBJS_DIR} ${LibSTRoot} ${LibGperfRoot} ${LibSSLRoot})
 | 
					ModuleLibIncs=(${SRS_OBJS_DIR} ${LibSTRoot} ${LibGperfRoot} ${LibSSLRoot})
 | 
				
			||||||
if [[ $SRS_RTC == YES ]]; then
 | 
					if [[ $SRS_RTC == YES ]]; then
 | 
				
			||||||
    ModuleLibIncs+=("${LibFfmpegRoot[*]}" ${LibSrtpRoot})
 | 
					    ModuleLibIncs+=(${LibSrtpRoot})
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					if [[ $SRS_FFMPEG_FIT == YES ]]; then
 | 
				
			||||||
 | 
					    ModuleLibIncs+=("${LibFfmpegRoot[*]}")
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
if [[ $SRS_SRT == YES ]]; then
 | 
					if [[ $SRS_SRT == YES ]]; then
 | 
				
			||||||
    MODULE_OBJS="${MODULE_OBJS} ${SRT_OBJS[@]}"
 | 
					    MODULE_OBJS="${MODULE_OBJS} ${SRT_OBJS[@]}"
 | 
				
			||||||
| 
						 | 
					@ -348,7 +369,10 @@ BUILD_KEY="srs" APP_MAIN="srs_main_server" APP_NAME="srs" . auto/apps.sh
 | 
				
			||||||
MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${PROTOCOL_OBJS[@]} ${MAIN_OBJS[@]}"
 | 
					MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${PROTOCOL_OBJS[@]} ${MAIN_OBJS[@]}"
 | 
				
			||||||
ModuleLibFiles=(${LibSTfile} ${LibSSLfile} ${LibGperfFile})
 | 
					ModuleLibFiles=(${LibSTfile} ${LibSSLfile} ${LibGperfFile})
 | 
				
			||||||
if [[ $SRS_RTC == YES ]]; then
 | 
					if [[ $SRS_RTC == YES ]]; then
 | 
				
			||||||
    ModuleLibFiles+=("${LibFfmpegFile[*]}" ${LibSrtpFile})
 | 
					    ModuleLibFiles+=(${LibSrtpFile})
 | 
				
			||||||
 | 
					fi
 | 
				
			||||||
 | 
					if [[ $SRS_FFMPEG_FIT == YES ]]; then
 | 
				
			||||||
 | 
					    ModuleLibFiles+=("${LibFfmpegFile[*]}")
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
for SRS_MODULE in ${SRS_MODULES[*]}; do
 | 
					for SRS_MODULE in ${SRS_MODULES[*]}; do
 | 
				
			||||||
| 
						 | 
					@ -370,14 +394,20 @@ if [ $SRS_UTEST = YES ]; then
 | 
				
			||||||
        "srs_utest_mp4" "srs_utest_service" "srs_utest_app" "srs_utest_rtc")
 | 
					        "srs_utest_mp4" "srs_utest_service" "srs_utest_app" "srs_utest_rtc")
 | 
				
			||||||
    ModuleLibIncs=(${SRS_OBJS_DIR} ${LibSTRoot} ${LibSSLRoot})
 | 
					    ModuleLibIncs=(${SRS_OBJS_DIR} ${LibSTRoot} ${LibSSLRoot})
 | 
				
			||||||
    if [[ $SRS_RTC == YES ]]; then
 | 
					    if [[ $SRS_RTC == YES ]]; then
 | 
				
			||||||
        ModuleLibIncs+=("${LibFfmpegRoot[*]}" ${LibSrtpRoot})
 | 
					        ModuleLibIncs+=(${LibSrtpRoot})
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					    if [[ $SRS_FFMPEG_FIT == YES ]]; then
 | 
				
			||||||
 | 
					        ModuleLibIncs+=("${LibFfmpegRoot[*]}")
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
    if [[ $SRS_SRT == YES ]]; then
 | 
					    if [[ $SRS_SRT == YES ]]; then
 | 
				
			||||||
        ModuleLibIncs+=("${LibSRTRoot[*]}")
 | 
					        ModuleLibIncs+=("${LibSRTRoot[*]}")
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
    ModuleLibFiles=(${LibSTfile} ${LibSSLfile})
 | 
					    ModuleLibFiles=(${LibSTfile} ${LibSSLfile})
 | 
				
			||||||
    if [[ $SRS_RTC == YES ]]; then
 | 
					    if [[ $SRS_RTC == YES ]]; then
 | 
				
			||||||
        ModuleLibFiles+=("${LibFfmpegFile[*]}" ${LibSrtpFile})
 | 
					        ModuleLibFiles+=(${LibSrtpFile})
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					    if [[ $SRS_FFMPEG_FIT == YES ]]; then
 | 
				
			||||||
 | 
					        ModuleLibFiles+=("${LibFfmpegFile[*]}")
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
    if [[ $SRS_SRT == YES ]]; then
 | 
					    if [[ $SRS_SRT == YES ]]; then
 | 
				
			||||||
        ModuleLibFiles+=("${LibSRTfile[*]}")
 | 
					        ModuleLibFiles+=("${LibSRTfile[*]}")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -247,7 +247,11 @@ SrsRtcSource::SrsRtcSource()
 | 
				
			||||||
    rtc_publisher_ = NULL;
 | 
					    rtc_publisher_ = NULL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    req = NULL;
 | 
					    req = NULL;
 | 
				
			||||||
 | 
					#ifdef SRS_FFMPEG_FIT
 | 
				
			||||||
    bridger_ = new SrsRtcFromRtmpBridger(this);
 | 
					    bridger_ = new SrsRtcFromRtmpBridger(this);
 | 
				
			||||||
 | 
					#else
 | 
				
			||||||
 | 
					    bridger_ = new SrsRtcDummyBridger();
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SrsRtcSource::~SrsRtcSource()
 | 
					SrsRtcSource::~SrsRtcSource()
 | 
				
			||||||
| 
						 | 
					@ -266,9 +270,12 @@ srs_error_t SrsRtcSource::initialize(SrsRequest* r)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    req = r->copy();
 | 
					    req = r->copy();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if ((err = bridger_->initialize(req)) != srs_success) {
 | 
					#ifdef SRS_FFMPEG_FIT
 | 
				
			||||||
 | 
					    SrsRtcFromRtmpBridger* bridger = dynamic_cast<SrsRtcFromRtmpBridger*>(bridger_);
 | 
				
			||||||
 | 
					    if ((err = bridger->initialize(req)) != srs_success) {
 | 
				
			||||||
        return srs_error_wrap(err, "bridge initialize");
 | 
					        return srs_error_wrap(err, "bridge initialize");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return err;
 | 
					    return err;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -414,6 +421,7 @@ srs_error_t SrsRtcSource::on_rtp(SrsRtpPacket2* pkt)
 | 
				
			||||||
    return err;
 | 
					    return err;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef SRS_FFMPEG_FIT
 | 
				
			||||||
SrsRtcFromRtmpBridger::SrsRtcFromRtmpBridger(SrsRtcSource* source)
 | 
					SrsRtcFromRtmpBridger::SrsRtcFromRtmpBridger(SrsRtcSource* source)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    req = NULL;
 | 
					    req = NULL;
 | 
				
			||||||
| 
						 | 
					@ -936,4 +944,32 @@ srs_error_t SrsRtcFromRtmpBridger::consume_packets(vector<SrsRtpPacket2*>& pkts)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return err;
 | 
					    return err;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SrsRtcDummyBridger::SrsRtcDummyBridger()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					SrsRtcDummyBridger::~SrsRtcDummyBridger()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					srs_error_t SrsRtcDummyBridger::on_publish()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    return srs_error_new(ERROR_RTC_DUMMY_BRIDGER, "no FFmpeg fit");
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					srs_error_t SrsRtcDummyBridger::on_audio(SrsSharedPtrMessage* /*audio*/)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    return srs_error_new(ERROR_RTC_DUMMY_BRIDGER, "no FFmpeg fit");
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					srs_error_t SrsRtcDummyBridger::on_video(SrsSharedPtrMessage* /*video*/)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    return srs_error_new(ERROR_RTC_DUMMY_BRIDGER, "no FFmpeg fit");
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void SrsRtcDummyBridger::on_unpublish()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -115,7 +115,7 @@ private:
 | 
				
			||||||
    SrsRequest* req;
 | 
					    SrsRequest* req;
 | 
				
			||||||
    ISrsRtcPublisher* rtc_publisher_;
 | 
					    ISrsRtcPublisher* rtc_publisher_;
 | 
				
			||||||
    // Transmux RTMP to RTC.
 | 
					    // Transmux RTMP to RTC.
 | 
				
			||||||
    SrsRtcFromRtmpBridger* bridger_;
 | 
					    ISrsSourceBridger* bridger_;
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
    // To delivery stream to clients.
 | 
					    // To delivery stream to clients.
 | 
				
			||||||
    std::vector<SrsRtcConsumer*> consumers;
 | 
					    std::vector<SrsRtcConsumer*> consumers;
 | 
				
			||||||
| 
						 | 
					@ -159,6 +159,7 @@ public:
 | 
				
			||||||
    srs_error_t on_rtp(SrsRtpPacket2* pkt);
 | 
					    srs_error_t on_rtp(SrsRtpPacket2* pkt);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#ifdef SRS_FFMPEG_FIT
 | 
				
			||||||
class SrsRtcFromRtmpBridger : public ISrsSourceBridger
 | 
					class SrsRtcFromRtmpBridger : public ISrsSourceBridger
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
private:
 | 
					private:
 | 
				
			||||||
| 
						 | 
					@ -197,6 +198,19 @@ private:
 | 
				
			||||||
    srs_error_t package_fu_a(SrsSharedPtrMessage* msg, SrsSample* sample, int fu_payload_size, std::vector<SrsRtpPacket2*>& pkts);
 | 
					    srs_error_t package_fu_a(SrsSharedPtrMessage* msg, SrsSample* sample, int fu_payload_size, std::vector<SrsRtpPacket2*>& pkts);
 | 
				
			||||||
    srs_error_t consume_packets(std::vector<SrsRtpPacket2*>& pkts);
 | 
					    srs_error_t consume_packets(std::vector<SrsRtpPacket2*>& pkts);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class SrsRtcDummyBridger : public ISrsSourceBridger
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
					    SrsRtcDummyBridger();
 | 
				
			||||||
 | 
					    virtual ~SrsRtcDummyBridger();
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
					    virtual srs_error_t on_publish();
 | 
				
			||||||
 | 
					    virtual srs_error_t on_audio(SrsSharedPtrMessage* audio);
 | 
				
			||||||
 | 
					    virtual srs_error_t on_video(SrsSharedPtrMessage* video);
 | 
				
			||||||
 | 
					    virtual void on_unpublish();
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -352,6 +352,7 @@
 | 
				
			||||||
#define ERROR_RTC_DISABLED                  5021
 | 
					#define ERROR_RTC_DISABLED                  5021
 | 
				
			||||||
#define ERROR_RTC_NO_SESSION                5022
 | 
					#define ERROR_RTC_NO_SESSION                5022
 | 
				
			||||||
#define ERROR_RTC_INVALID_PARAMS            5023
 | 
					#define ERROR_RTC_INVALID_PARAMS            5023
 | 
				
			||||||
 | 
					#define ERROR_RTC_DUMMY_BRIDGER             5024
 | 
				
			||||||
 | 
					
 | 
				
			||||||
///////////////////////////////////////////////////////
 | 
					///////////////////////////////////////////////////////
 | 
				
			||||||
// GB28181 API error.
 | 
					// GB28181 API error.
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue