mirror of
				https://github.com/ossrs/srs.git
				synced 2025-03-09 15:49:59 +00:00 
			
		
		
		
	
							parent
							
								
									37c84eccc0
								
							
						
					
					
						commit
						602a478e1b
					
				
					 12 changed files with 133 additions and 28 deletions
				
			
		| 
						 | 
				
			
			@ -5,7 +5,7 @@ jobs:
 | 
			
		|||
      - image: ossrs/srs:dev
 | 
			
		||||
    steps:
 | 
			
		||||
      - checkout
 | 
			
		||||
      - run: cd trunk && ./configure && make
 | 
			
		||||
      - run: cd trunk && ./configure --without-rtc && make && ./configure && make
 | 
			
		||||
  test:
 | 
			
		||||
    docker:
 | 
			
		||||
      - image: ossrs/srs:dev
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -73,6 +73,12 @@ else
 | 
			
		|||
    srs_undefine_macro "SRS_AUTO_SRT" $SRS_AUTO_HEADERS_H
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [ $SRS_RTC = YES ]; then
 | 
			
		||||
    srs_define_macro "SRS_AUTO_RTC" $SRS_AUTO_HEADERS_H
 | 
			
		||||
else
 | 
			
		||||
    srs_undefine_macro "SRS_AUTO_RTC" $SRS_AUTO_HEADERS_H
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [ $SRS_MEM_WATCH = YES ]; then
 | 
			
		||||
    srs_define_macro "SRS_AUTO_MEM_WATCH" $SRS_AUTO_HEADERS_H
 | 
			
		||||
else
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -399,7 +399,7 @@ fi
 | 
			
		|||
#####################################################################################
 | 
			
		||||
# libopus, for WebRTC to transcode AAC with Opus.
 | 
			
		||||
#####################################################################################
 | 
			
		||||
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
 | 
			
		||||
if [[ $SRS_EXPORT_LIBRTMP_PROJECT == NO && $SRS_RTC == YES ]]; then
 | 
			
		||||
    if [[ -f ${SRS_OBJS}/opus/lib/libopus.a ]]; then
 | 
			
		||||
        echo "The opus-1.3.1 is ok.";
 | 
			
		||||
    else
 | 
			
		||||
| 
						 | 
				
			
			@ -419,7 +419,7 @@ fi
 | 
			
		|||
#####################################################################################
 | 
			
		||||
# ffmpeg-fix, for WebRTC to transcode AAC with Opus.
 | 
			
		||||
#####################################################################################
 | 
			
		||||
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
 | 
			
		||||
if [[ $SRS_EXPORT_LIBRTMP_PROJECT == NO && $SRS_RTC == YES ]]; then
 | 
			
		||||
    if [[ -f ${SRS_OBJS}/ffmpeg/lib/libavcodec.a ]]; then
 | 
			
		||||
        echo "The ffmpeg-4.2-fit is ok.";
 | 
			
		||||
    else
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -17,6 +17,7 @@ help=no
 | 
			
		|||
# feature options
 | 
			
		||||
SRS_HDS=NO
 | 
			
		||||
SRS_SRT=NO
 | 
			
		||||
SRS_RTC=YES
 | 
			
		||||
SRS_NGINX=NO
 | 
			
		||||
SRS_FFMPEG_TOOL=NO
 | 
			
		||||
SRS_LIBRTMP=NO
 | 
			
		||||
| 
						 | 
				
			
			@ -130,7 +131,8 @@ Features:
 | 
			
		|||
  --with-librtmp            Enable srs-librtmp, library for client.
 | 
			
		||||
  --with-research           Build the research tools.
 | 
			
		||||
  --with-utest              Build the utest for SRS.
 | 
			
		||||
  --with-srt                Build the srt for SRS.
 | 
			
		||||
  --with-srt                Build the SRT support for SRS.
 | 
			
		||||
  --with-rtc                Build the WebRTC support for SRS.
 | 
			
		||||
 | 
			
		||||
  --without-ssl             Disable rtmp complex handshake.
 | 
			
		||||
  --without-hds             Disable hds, the adobe http dynamic streaming.
 | 
			
		||||
| 
						 | 
				
			
			@ -139,7 +141,8 @@ Features:
 | 
			
		|||
  --without-librtmp         Disable srs-librtmp, library for client.
 | 
			
		||||
  --without-research        Do not build the research tools.
 | 
			
		||||
  --without-utest           Do not build the utest for SRS.
 | 
			
		||||
  --without-srt             Do not build the srt for SRS.
 | 
			
		||||
  --without-srt             Do not build the SRT support for SRS.
 | 
			
		||||
  --without-rtc             Do not build the WebRTC support for SRS.
 | 
			
		||||
 | 
			
		||||
  --prefix=<path>           The absolute installation path for srs. Default: $SRS_PREFIX
 | 
			
		||||
  --static                  Whether add '-static' to link options.
 | 
			
		||||
| 
						 | 
				
			
			@ -225,6 +228,7 @@ function parse_user_option() {
 | 
			
		|||
        --with-research)                SRS_RESEARCH=YES            ;;
 | 
			
		||||
        --with-utest)                   SRS_UTEST=YES               ;;
 | 
			
		||||
        --with-srt)                     SRS_SRT=YES                 ;;
 | 
			
		||||
        --with-rtc)                     SRS_RTC=YES                 ;;
 | 
			
		||||
        --with-gperf)                   SRS_GPERF=YES               ;;
 | 
			
		||||
        --with-gmc)                     SRS_GPERF_MC=YES            ;;
 | 
			
		||||
        --with-gmd)                     SRS_GPERF_MD=YES            ;;
 | 
			
		||||
| 
						 | 
				
			
			@ -241,6 +245,7 @@ function parse_user_option() {
 | 
			
		|||
        --without-research)             SRS_RESEARCH=NO             ;;
 | 
			
		||||
        --without-utest)                SRS_UTEST=NO                ;;
 | 
			
		||||
        --without-srt)                  SRS_SRT=NO                  ;;
 | 
			
		||||
        --without-rtc)                  SRS_RTC=NO                  ;;
 | 
			
		||||
        --without-gperf)                SRS_GPERF=NO                ;;
 | 
			
		||||
        --without-gmc)                  SRS_GPERF_MC=NO             ;;
 | 
			
		||||
        --without-gmd)                  SRS_GPERF_MD=NO             ;;
 | 
			
		||||
| 
						 | 
				
			
			@ -539,6 +544,7 @@ function regenerate_options() {
 | 
			
		|||
    if [ $SRS_RESEARCH = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-research"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-research"; fi
 | 
			
		||||
    if [ $SRS_UTEST = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-utest"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-utest"; fi
 | 
			
		||||
    if [ $SRS_SRT = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-srt"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-srt"; fi
 | 
			
		||||
    if [ $SRS_RTC = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-rtc"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-rtc"; fi
 | 
			
		||||
    if [ $SRS_GPERF = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gperf"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gperf"; fi
 | 
			
		||||
    if [ $SRS_GPERF_MC = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gmc"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gmc"; fi
 | 
			
		||||
    if [ $SRS_GPERF_MD = YES ]; then SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --with-gmd"; else SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --without-gmd"; fi
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										76
									
								
								trunk/configure
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										76
									
								
								trunk/configure
									
										
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -149,10 +149,14 @@ END
 | 
			
		|||
LibSTRoot="${SRS_OBJS_DIR}/st"; LibSTfile="${LibSTRoot}/libst.a"
 | 
			
		||||
if [[ $SRS_SHARED_ST == YES ]]; then LibSTfile="-lst"; fi
 | 
			
		||||
# srtp
 | 
			
		||||
LibSrtpRoot="${SRS_OBJS_DIR}/srtp2/include"; LibSrtpFile="${SRS_OBJS_DIR}/srtp2/lib/libsrtp2.a"
 | 
			
		||||
# ffmpeg
 | 
			
		||||
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 -lpthread"
 | 
			
		||||
LibFfmpegRoot="${LibFfmpegRoot} ${SRS_OBJS_DIR}/opus/include"; LibFfmpegFile="${LibFfmpegFile} ${SRS_OBJS_DIR}/opus/lib/libopus.a"
 | 
			
		||||
if [[ $SRS_RTC == YES ]]; then
 | 
			
		||||
  LibSrtpRoot="${SRS_OBJS_DIR}/srtp2/include"; LibSrtpFile="${SRS_OBJS_DIR}/srtp2/lib/libsrtp2.a"
 | 
			
		||||
fi
 | 
			
		||||
# FFMPEG for WebRTC transcoding, such as aac to opus.
 | 
			
		||||
if [[ $SRS_RTC == 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="${LibFfmpegRoot} ${SRS_OBJS_DIR}/opus/include"; LibFfmpegFile="${LibFfmpegFile} ${SRS_OBJS_DIR}/opus/lib/libopus.a"
 | 
			
		||||
fi
 | 
			
		||||
# openssl-1.1.0e, for the RTMP complex handshake.
 | 
			
		||||
LibSSLRoot="";LibSSLfile=""
 | 
			
		||||
if [[ $SRS_SSL == YES && $SRS_USE_SYS_SSL == NO ]]; then
 | 
			
		||||
| 
						 | 
				
			
			@ -173,7 +177,7 @@ if [[ $SRS_SRT == YES ]]; then
 | 
			
		|||
fi
 | 
			
		||||
# the link options, always use static link
 | 
			
		||||
SrsLinkOptions="-ldl";
 | 
			
		||||
if [[ $SRS_SRT == YES ]]; then
 | 
			
		||||
if [[ $SRS_SRT == YES || $SRS_RTC == YES ]]; then
 | 
			
		||||
    SrsLinkOptions="${SrsLinkOptions} -lpthread";
 | 
			
		||||
fi
 | 
			
		||||
if [[ $SRS_SSL == YES && $SRS_USE_SYS_SSL == YES ]]; then
 | 
			
		||||
| 
						 | 
				
			
			@ -206,9 +210,12 @@ MODULE_ID="KERNEL"
 | 
			
		|||
MODULE_DEPENDS=("CORE") 
 | 
			
		||||
ModuleLibIncs=(${SRS_OBJS_DIR} ${LibSSLRoot})
 | 
			
		||||
MODULE_FILES=("srs_kernel_error" "srs_kernel_log" "srs_kernel_buffer"
 | 
			
		||||
        "srs_kernel_utility" "srs_kernel_flv" "srs_kernel_rtp" "srs_kernel_codec" "srs_kernel_io"
 | 
			
		||||
        "srs_kernel_utility" "srs_kernel_flv" "srs_kernel_codec" "srs_kernel_io"
 | 
			
		||||
        "srs_kernel_consts" "srs_kernel_aac" "srs_kernel_mp3" "srs_kernel_ts"
 | 
			
		||||
        "srs_kernel_stream" "srs_kernel_balance" "srs_kernel_mp4" "srs_kernel_file")
 | 
			
		||||
if [[ $SRS_RTC == YES ]]; then
 | 
			
		||||
    MODULE_FILES+=("srs_kernel_rtp")
 | 
			
		||||
fi
 | 
			
		||||
KERNEL_INCS="src/kernel"; MODULE_DIR=${KERNEL_INCS} . auto/modules.sh
 | 
			
		||||
KERNEL_OBJS="${MODULE_OBJS[@]}"
 | 
			
		||||
#
 | 
			
		||||
| 
						 | 
				
			
			@ -219,7 +226,10 @@ ModuleLibIncs=(${SRS_OBJS_DIR} ${LibSSLRoot})
 | 
			
		|||
MODULE_FILES=("srs_protocol_amf0" "srs_protocol_io" "srs_rtmp_stack"
 | 
			
		||||
        "srs_rtmp_handshake" "srs_protocol_utility" "srs_rtmp_msg_array" "srs_protocol_stream"
 | 
			
		||||
        "srs_raw_avc" "srs_rtsp_stack" "srs_http_stack" "srs_protocol_kbps" "srs_protocol_json"
 | 
			
		||||
        "srs_stun_stack" "srs_protocol_format")
 | 
			
		||||
        "srs_protocol_format")
 | 
			
		||||
if [[ $SRS_RTC == YES ]]; then
 | 
			
		||||
    MODULE_FILES+=("srs_stun_stack")
 | 
			
		||||
fi
 | 
			
		||||
PROTOCOL_INCS="src/protocol"; MODULE_DIR=${PROTOCOL_INCS} . auto/modules.sh
 | 
			
		||||
PROTOCOL_OBJS="${MODULE_OBJS[@]}"
 | 
			
		||||
#
 | 
			
		||||
| 
						 | 
				
			
			@ -238,7 +248,10 @@ fi
 | 
			
		|||
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
 | 
			
		||||
    MODULE_ID="SERVICE"
 | 
			
		||||
    MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL")
 | 
			
		||||
    ModuleLibIncs=(${LibSTRoot} ${LibSrtpRoot} ${LibFfmpegRoot} ${SRS_OBJS_DIR} ${LibSSLRoot})
 | 
			
		||||
    ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibSSLRoot})
 | 
			
		||||
    if [[ $SRS_RTC == YES ]]; then
 | 
			
		||||
        ModuleLibIncs+=("${LibFfmpegRoot[*]}" ${LibSrtpRoot})
 | 
			
		||||
    fi
 | 
			
		||||
    MODULE_FILES=("srs_service_log" "srs_service_st" "srs_service_http_client"
 | 
			
		||||
        "srs_service_http_conn" "srs_service_rtmp_conn" "srs_service_utility"
 | 
			
		||||
        "srs_service_conn")
 | 
			
		||||
| 
						 | 
				
			
			@ -251,7 +264,10 @@ fi
 | 
			
		|||
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
 | 
			
		||||
    MODULE_ID="APP" 
 | 
			
		||||
    MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "SERVICE")
 | 
			
		||||
    ModuleLibIncs=(${LibSTRoot} ${LibSrtpRoot} ${LibFfmpegRoot} ${SRS_OBJS_DIR} ${LibSSLRoot})
 | 
			
		||||
    ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibSSLRoot})
 | 
			
		||||
    if [[ $SRS_RTC == YES ]]; then
 | 
			
		||||
        ModuleLibIncs+=("${LibFfmpegRoot[*]}" ${LibSrtpRoot})
 | 
			
		||||
    fi
 | 
			
		||||
    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_thread" "srs_app_bandwidth" "srs_app_st" "srs_app_log" "srs_app_config" 
 | 
			
		||||
| 
						 | 
				
			
			@ -259,10 +275,13 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
 | 
			
		|||
            "srs_app_ingest" "srs_app_ffmpeg" "srs_app_utility" "srs_app_edge"
 | 
			
		||||
            "srs_app_heartbeat" "srs_app_empty" "srs_app_http_client" "srs_app_http_static"
 | 
			
		||||
            "srs_app_recv_thread" "srs_app_security" "srs_app_statistic" "srs_app_hds"
 | 
			
		||||
            "srs_app_mpegts_udp" "srs_app_rtc" "srs_app_rtc_conn" "srs_app_dtls" "srs_app_rtsp" "srs_app_listener" "srs_app_async_call"
 | 
			
		||||
            "srs_app_mpegts_udp" "srs_app_rtsp" "srs_app_listener" "srs_app_async_call"
 | 
			
		||||
            "srs_app_caster_flv" "srs_app_process" "srs_app_ng_exec"
 | 
			
		||||
            "srs_app_hourglass" "srs_app_dash" "srs_app_fragment" "srs_app_dvr"
 | 
			
		||||
            "srs_app_coworkers" "srs_app_hybrid" "srs_app_audio_recode")
 | 
			
		||||
            "srs_app_coworkers" "srs_app_hybrid")
 | 
			
		||||
    if [[ $SRS_RTC == YES ]]; then
 | 
			
		||||
        MODULE_FILES+=("srs_app_rtc" "srs_app_rtc_conn" "srs_app_dtls" "srs_app_audio_recode")
 | 
			
		||||
    fi
 | 
			
		||||
    DEFINES=""
 | 
			
		||||
    # add each modules for app
 | 
			
		||||
    for SRS_MODULE in ${SRS_MODULES[*]}; do
 | 
			
		||||
| 
						 | 
				
			
			@ -289,7 +308,10 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
 | 
			
		|||
    if [[ $SRS_SRT == YES ]]; then
 | 
			
		||||
        MODULE_DEPENDS+=("SRT")
 | 
			
		||||
    fi
 | 
			
		||||
    ModuleLibIncs=(${LibSTRoot} ${LibSrtpRoot} ${LibFfmpegRoot} ${SRS_OBJS_DIR} ${LibGperfRoot} ${LibSSLRoot})
 | 
			
		||||
    ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibGperfRoot} ${LibSSLRoot})
 | 
			
		||||
    if [[ $SRS_RTC == YES ]]; then
 | 
			
		||||
        ModuleLibIncs+=("${LibFfmpegRoot[*]}" ${LibSrtpRoot})
 | 
			
		||||
    fi
 | 
			
		||||
    if [[ $SRS_SRT == YES ]]; then
 | 
			
		||||
        ModuleLibIncs+=("${LibSRTRoot[*]}")
 | 
			
		||||
    fi
 | 
			
		||||
| 
						 | 
				
			
			@ -302,7 +324,10 @@ fi
 | 
			
		|||
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
 | 
			
		||||
    MODULE_ID="MAIN"
 | 
			
		||||
    MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "SERVICE")
 | 
			
		||||
    ModuleLibIncs=(${LibSTRoot} ${LibSrtpRoot} ${LibFfmpegRoot} ${SRS_OBJS_DIR} ${LibGperfRoot} ${LibSSLRoot})
 | 
			
		||||
    ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibGperfRoot} ${LibSSLRoot})
 | 
			
		||||
    if [[ $SRS_RTC == YES ]]; then
 | 
			
		||||
        ModuleLibIncs+=("${LibFfmpegRoot[*]}" ${LibSrtpRoot})
 | 
			
		||||
    fi
 | 
			
		||||
    MODULE_FILES=()
 | 
			
		||||
    DEFINES=""
 | 
			
		||||
    # add each modules for main
 | 
			
		||||
| 
						 | 
				
			
			@ -329,13 +354,19 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
 | 
			
		|||
    done
 | 
			
		||||
    #
 | 
			
		||||
    # all depends libraries
 | 
			
		||||
    ModuleLibFiles=(${LibSTfile} ${LibSrtpFile} ${LibFfmpegFile} ${LibSSLfile} ${LibGperfFile})
 | 
			
		||||
    ModuleLibFiles=(${LibSTfile} ${LibSSLfile} ${LibGperfFile})
 | 
			
		||||
    if [[ $SRS_RTC == YES ]]; then
 | 
			
		||||
        ModuleLibFiles+=("${LibFfmpegFile[*]}" ${LibSrtpFile})
 | 
			
		||||
    fi
 | 
			
		||||
    if [[ $SRS_SRT == YES ]]; then
 | 
			
		||||
        ModuleLibFiles+=("${LibSRTfile[*]}")
 | 
			
		||||
    fi
 | 
			
		||||
    # all depends objects
 | 
			
		||||
    MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${PROTOCOL_OBJS[@]} ${SERVICE_OBJS[@]} ${APP_OBJS[@]} ${SERVER_OBJS[@]}"
 | 
			
		||||
    ModuleLibIncs=(${LibSTRoot} ${LibSrtpRoot} ${LibFfmpegRoot} ${SRS_OBJS_DIR} ${LibGperfRoot} ${LibSSLRoot})
 | 
			
		||||
    ModuleLibIncs=(${LibSTRoot} ${SRS_OBJS_DIR} ${LibGperfRoot} ${LibSSLRoot})
 | 
			
		||||
    if [[ $SRS_RTC == YES ]]; then
 | 
			
		||||
        ModuleLibIncs+=("${LibFfmpegRoot[*]}" ${LibSrtpRoot})
 | 
			
		||||
    fi
 | 
			
		||||
    if [[ $SRS_SRT == YES ]]; then
 | 
			
		||||
        MODULE_OBJS="${MODULE_OBJS} ${SRT_OBJS[@]}"
 | 
			
		||||
    fi
 | 
			
		||||
| 
						 | 
				
			
			@ -346,7 +377,10 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
 | 
			
		|||
    #
 | 
			
		||||
    # For modules, without the app module.
 | 
			
		||||
    MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${PROTOCOL_OBJS[@]} ${SERVICE_OBJS[@]} ${MAIN_OBJS[@]}"
 | 
			
		||||
    ModuleLibFiles=(${LibSTfile} ${LibSrtpFile} ${LibFfmpegFile} ${LibSSLfile} ${LibGperfFile})
 | 
			
		||||
    ModuleLibFiles=(${LibSTfile} ${LibSSLfile} ${LibGperfFile})
 | 
			
		||||
    if [[ $SRS_RTC == YES ]]; then
 | 
			
		||||
        ModuleLibFiles+=("${LibFfmpegFile[*]}" ${LibSrtpFile})
 | 
			
		||||
    fi
 | 
			
		||||
    #
 | 
			
		||||
    for SRS_MODULE in ${SRS_MODULES[*]}; do
 | 
			
		||||
        . $SRS_MODULE/config
 | 
			
		||||
| 
						 | 
				
			
			@ -366,11 +400,17 @@ if [ $SRS_UTEST = YES ]; then
 | 
			
		|||
    MODULE_FILES=("srs_utest" "srs_utest_amf0" "srs_utest_protocol" "srs_utest_kernel" "srs_utest_core"
 | 
			
		||||
        "srs_utest_config" "srs_utest_rtmp" "srs_utest_http" "srs_utest_avc" "srs_utest_reload"
 | 
			
		||||
        "srs_utest_mp4" "srs_utest_service" "srs_utest_app")
 | 
			
		||||
    ModuleLibIncs=(${SRS_OBJS_DIR} ${LibSTRoot} ${LibSrtpRoot} ${LibFfmpegRoot} ${LibSSLRoot})
 | 
			
		||||
    ModuleLibIncs=(${SRS_OBJS_DIR} ${LibSTRoot} ${LibSSLRoot})
 | 
			
		||||
    if [[ $SRS_RTC == YES ]]; then
 | 
			
		||||
        ModuleLibIncs+=("${LibFfmpegRoot[*]}" ${LibSrtpRoot})
 | 
			
		||||
    fi
 | 
			
		||||
    if [[ $SRS_SRT == YES ]]; then
 | 
			
		||||
        ModuleLibIncs+=("${LibSRTRoot[*]}")
 | 
			
		||||
    fi
 | 
			
		||||
    ModuleLibFiles=(${LibSTfile} ${LibSrtpFile} ${LibFfmpegFile} ${LibSSLfile})
 | 
			
		||||
    ModuleLibFiles=(${LibSTfile} ${LibSSLfile})
 | 
			
		||||
    if [[ $SRS_RTC == YES ]]; then
 | 
			
		||||
        ModuleLibFiles+=("${LibFfmpegFile[*]}" ${LibSrtpFile})
 | 
			
		||||
    fi
 | 
			
		||||
    if [[ $SRS_SRT == YES ]]; then
 | 
			
		||||
        ModuleLibFiles+=("${LibSRTfile[*]}")
 | 
			
		||||
    fi
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -46,7 +46,9 @@ using namespace std;
 | 
			
		|||
#include <srs_protocol_amf0.hpp>
 | 
			
		||||
#include <srs_protocol_utility.hpp>
 | 
			
		||||
#include <srs_app_coworkers.hpp>
 | 
			
		||||
#ifdef SRS_AUTO_RTC
 | 
			
		||||
#include <srs_app_rtc_conn.hpp>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
srs_error_t srs_api_response_jsonp(ISrsHttpResponseWriter* w, string callback, string data)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -781,6 +783,7 @@ srs_error_t SrsGoApiStreams::serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessa
 | 
			
		|||
    return srs_api_response(w, r, obj->dumps());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef SRS_AUTO_RTC
 | 
			
		||||
SrsGoApiSdp::SrsGoApiSdp(SrsRtcServer* rtc_svr)
 | 
			
		||||
{
 | 
			
		||||
    rtc_server = rtc_svr;
 | 
			
		||||
| 
						 | 
				
			
			@ -907,6 +910,7 @@ srs_error_t SrsGoApiSdp::do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessag
 | 
			
		|||
 | 
			
		||||
    return err;
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
SrsGoApiClients::SrsGoApiClients()
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -166,6 +166,7 @@ public:
 | 
			
		|||
    virtual srs_error_t serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#ifdef SRS_AUTO_RTC
 | 
			
		||||
class SrsGoApiSdp : public ISrsHttpHandler
 | 
			
		||||
{
 | 
			
		||||
private:
 | 
			
		||||
| 
						 | 
				
			
			@ -178,6 +179,7 @@ public:
 | 
			
		|||
private:
 | 
			
		||||
    virtual srs_error_t do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r, SrsJsonObject* res);
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
class SrsGoApiClients : public ISrsHttpHandler
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,7 +33,6 @@ using namespace std;
 | 
			
		|||
#include <srs_kernel_codec.hpp>
 | 
			
		||||
#include <srs_kernel_rtp.hpp>
 | 
			
		||||
#include <srs_app_hls.hpp>
 | 
			
		||||
#include <srs_app_rtc.hpp>
 | 
			
		||||
#include <srs_app_forward.hpp>
 | 
			
		||||
#include <srs_app_config.hpp>
 | 
			
		||||
#include <srs_app_encoder.hpp>
 | 
			
		||||
| 
						 | 
				
			
			@ -51,6 +50,9 @@ using namespace std;
 | 
			
		|||
#include <srs_app_ng_exec.hpp>
 | 
			
		||||
#include <srs_app_dash.hpp>
 | 
			
		||||
#include <srs_protocol_format.hpp>
 | 
			
		||||
#ifdef SRS_AUTO_RTC
 | 
			
		||||
#include <srs_app_rtc.hpp>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define CONST_MAX_JITTER_MS         250
 | 
			
		||||
#define CONST_MAX_JITTER_MS_NEG         -250
 | 
			
		||||
| 
						 | 
				
			
			@ -816,6 +818,7 @@ SrsSharedPtrMessage* SrsMixQueue::pop()
 | 
			
		|||
    return msg;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef SRS_AUTO_RTC
 | 
			
		||||
SrsRtpPacketQueue::SrsRtpPacketQueue()
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -864,6 +867,7 @@ SrsRtpSharedPacket* SrsRtpPacketQueue::find(const uint16_t& sequence)
 | 
			
		|||
 | 
			
		||||
    return pkt;
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
SrsOriginHub::SrsOriginHub()
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -875,7 +879,9 @@ SrsOriginHub::SrsOriginHub()
 | 
			
		|||
    dash = new SrsDash();
 | 
			
		||||
    dvr = new SrsDvr();
 | 
			
		||||
    encoder = new SrsEncoder();
 | 
			
		||||
#ifdef SRS_AUTO_RTC
 | 
			
		||||
    rtc = new SrsRtc();
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef SRS_AUTO_HDS
 | 
			
		||||
    hds = new SrsHds();
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			@ -920,9 +926,11 @@ srs_error_t SrsOriginHub::initialize(SrsSource* s, SrsRequest* r)
 | 
			
		|||
        return srs_error_wrap(err, "format initialize");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#ifdef SRS_AUTO_RTC
 | 
			
		||||
    if ((err = rtc->initialize(this, req)) != srs_success) {
 | 
			
		||||
        return srs_error_wrap(err, "rtc initialize");
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
    
 | 
			
		||||
    if ((err = hls->initialize(this, req)) != srs_success) {
 | 
			
		||||
        return srs_error_wrap(err, "hls initialize");
 | 
			
		||||
| 
						 | 
				
			
			@ -1022,11 +1030,13 @@ srs_error_t SrsOriginHub::on_audio(SrsSharedPtrMessage* shared_audio)
 | 
			
		|||
                  srs_flv_srates[c->sound_rate]);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#ifdef SRS_AUTO_RTC
 | 
			
		||||
    if ((err = rtc->on_audio(msg, format)) != srs_success) {
 | 
			
		||||
        srs_warn("rtc: ignore audio error %s", srs_error_desc(err).c_str());
 | 
			
		||||
        srs_error_reset(err);
 | 
			
		||||
        rtc->on_unpublish();
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
    
 | 
			
		||||
    if ((err = hls->on_audio(msg, format)) != srs_success) {
 | 
			
		||||
        // apply the error strategy for hls.
 | 
			
		||||
| 
						 | 
				
			
			@ -1121,6 +1131,7 @@ srs_error_t SrsOriginHub::on_video(SrsSharedPtrMessage* shared_video, bool is_se
 | 
			
		|||
        return err;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#ifdef SRS_AUTO_RTC
 | 
			
		||||
    // Parse RTMP message to RTP packets, in FU-A if too large.
 | 
			
		||||
    if ((err = rtc->on_video(msg, format)) != srs_success) {
 | 
			
		||||
        // TODO: We should support more strategies.
 | 
			
		||||
| 
						 | 
				
			
			@ -1132,6 +1143,7 @@ srs_error_t SrsOriginHub::on_video(SrsSharedPtrMessage* shared_video, bool is_se
 | 
			
		|||
    // TODO: FIXME: Refactor to move to rtp?
 | 
			
		||||
    // Save the RTP packets for find_rtp_packet() to rtx or restore it.
 | 
			
		||||
    source->rtp_queue->push(msg->rtp_packets);
 | 
			
		||||
#endif
 | 
			
		||||
    
 | 
			
		||||
    if ((err = hls->on_video(msg, format)) != srs_success) {
 | 
			
		||||
        // TODO: We should support more strategies.
 | 
			
		||||
| 
						 | 
				
			
			@ -1201,9 +1213,11 @@ srs_error_t SrsOriginHub::on_publish()
 | 
			
		|||
        return srs_error_wrap(err, "encoder publish");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#ifdef SRS_AUTO_RTC
 | 
			
		||||
    if ((err = rtc->on_publish()) != srs_success) {
 | 
			
		||||
        return srs_error_wrap(err, "rtc publish");
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    if ((err = hls->on_publish()) != srs_success) {
 | 
			
		||||
        return srs_error_wrap(err, "hls publish");
 | 
			
		||||
| 
						 | 
				
			
			@ -1242,7 +1256,9 @@ void SrsOriginHub::on_unpublish()
 | 
			
		|||
    destroy_forwarders();
 | 
			
		||||
    
 | 
			
		||||
    encoder->on_unpublish();
 | 
			
		||||
#ifdef SRS_AUTO_RTC
 | 
			
		||||
    rtc->on_unpublish();
 | 
			
		||||
#endif
 | 
			
		||||
    hls->on_unpublish();
 | 
			
		||||
    dash->on_unpublish();
 | 
			
		||||
    dvr->on_unpublish();
 | 
			
		||||
| 
						 | 
				
			
			@ -1904,7 +1920,9 @@ SrsSource::SrsSource()
 | 
			
		|||
    jitter_algorithm = SrsRtmpJitterAlgorithmOFF;
 | 
			
		||||
    mix_correct = false;
 | 
			
		||||
    mix_queue = new SrsMixQueue();
 | 
			
		||||
#ifdef SRS_AUTO_RTC
 | 
			
		||||
    rtp_queue = new SrsRtpPacketQueue();
 | 
			
		||||
#endif
 | 
			
		||||
    
 | 
			
		||||
    _can_publish = true;
 | 
			
		||||
    _pre_source_id = _source_id = -1;
 | 
			
		||||
| 
						 | 
				
			
			@ -1934,7 +1952,9 @@ SrsSource::~SrsSource()
 | 
			
		|||
    srs_freep(hub);
 | 
			
		||||
    srs_freep(meta);
 | 
			
		||||
    srs_freep(mix_queue);
 | 
			
		||||
#ifdef SRS_AUTO_RTC
 | 
			
		||||
    srs_freep(rtp_queue);
 | 
			
		||||
#endif
 | 
			
		||||
    
 | 
			
		||||
    srs_freep(play_edge);
 | 
			
		||||
    srs_freep(publish_edge);
 | 
			
		||||
| 
						 | 
				
			
			@ -2692,7 +2712,9 @@ string SrsSource::get_curr_origin()
 | 
			
		|||
    return play_edge->get_curr_origin();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef SRS_AUTO_RTC
 | 
			
		||||
SrsRtpSharedPacket* SrsSource::find_rtp_packet(const uint16_t& seq)
 | 
			
		||||
{
 | 
			
		||||
    return rtp_queue->find(seq);
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -325,6 +325,7 @@ public:
 | 
			
		|||
    virtual SrsSharedPtrMessage* pop();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#ifdef SRS_AUTO_RTC
 | 
			
		||||
// To find the RTP packet for RTX or restore.
 | 
			
		||||
class SrsRtpPacketQueue
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -347,6 +348,7 @@ public:
 | 
			
		|||
    void insert(const uint16_t& sequence, SrsRtpSharedPacket* pkt);
 | 
			
		||||
    SrsRtpSharedPacket* find(const uint16_t& sequence);
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
// The hub for origin is a collection of utilities for origin only,
 | 
			
		||||
// For example, DVR, HLS, Forward and Transcode are only available for origin,
 | 
			
		||||
| 
						 | 
				
			
			@ -360,8 +362,10 @@ private:
 | 
			
		|||
private:
 | 
			
		||||
    // The format, codec information.
 | 
			
		||||
    SrsRtmpFormat* format;
 | 
			
		||||
#ifdef SRS_AUTO_RTC
 | 
			
		||||
    // rtc handler
 | 
			
		||||
    SrsRtc* rtc;
 | 
			
		||||
#endif
 | 
			
		||||
    // hls handler.
 | 
			
		||||
    SrsHls* hls;
 | 
			
		||||
    // The DASH encoder.
 | 
			
		||||
| 
						 | 
				
			
			@ -534,8 +538,10 @@ private:
 | 
			
		|||
    bool mix_correct;
 | 
			
		||||
    // The mix queue to implements the mix correct algorithm.
 | 
			
		||||
    SrsMixQueue* mix_queue;
 | 
			
		||||
#ifdef SRS_AUTO_RTC
 | 
			
		||||
    // rtp packet queue
 | 
			
		||||
    SrsRtpPacketQueue* rtp_queue;
 | 
			
		||||
#endif
 | 
			
		||||
    // For play, whether enabled atc.
 | 
			
		||||
    // The atc(use absolute time and donot adjust time),
 | 
			
		||||
    // directly use msg time and donot adjust if atc is true,
 | 
			
		||||
| 
						 | 
				
			
			@ -625,8 +631,10 @@ public:
 | 
			
		|||
public:
 | 
			
		||||
    virtual std::string get_curr_origin();
 | 
			
		||||
public:
 | 
			
		||||
#ifdef SRS_AUTO_RTC
 | 
			
		||||
    // Find rtp packet by sequence
 | 
			
		||||
    SrsRtpSharedPacket* find_rtp_packet(const uint16_t& seq);
 | 
			
		||||
#endif
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -36,11 +36,13 @@ using namespace std;
 | 
			
		|||
#include <srs_kernel_error.hpp>
 | 
			
		||||
#include <srs_kernel_buffer.hpp>
 | 
			
		||||
#include <srs_kernel_file.hpp>
 | 
			
		||||
#include <srs_kernel_rtp.hpp>
 | 
			
		||||
#include <srs_kernel_codec.hpp>
 | 
			
		||||
#include <srs_kernel_utility.hpp>
 | 
			
		||||
#include <srs_core_mem_watch.hpp>
 | 
			
		||||
#include <srs_core_autofree.hpp>
 | 
			
		||||
#ifdef SRS_AUTO_RTC
 | 
			
		||||
#include <srs_kernel_rtp.hpp>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
SrsMessageHeader::SrsMessageHeader()
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -230,9 +232,11 @@ SrsSharedPtrMessage::~SrsSharedPtrMessage()
 | 
			
		|||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
#ifdef SRS_AUTO_RTC
 | 
			
		||||
    for (int i = 0; i < (int)rtp_packets.size(); ++i) {
 | 
			
		||||
        srs_freep(rtp_packets[i]);
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
srs_error_t SrsSharedPtrMessage::create(SrsCommonMessage* msg)
 | 
			
		||||
| 
						 | 
				
			
			@ -351,17 +355,21 @@ SrsSharedPtrMessage* SrsSharedPtrMessage::copy()
 | 
			
		|||
    copy->payload = ptr->payload;
 | 
			
		||||
    copy->size = ptr->size;
 | 
			
		||||
 | 
			
		||||
#ifdef SRS_AUTO_RTC
 | 
			
		||||
    for (int i = 0; i < (int)rtp_packets.size(); ++i) {
 | 
			
		||||
        copy->rtp_packets.push_back(rtp_packets[i]->copy());
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    return copy;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef SRS_AUTO_RTC
 | 
			
		||||
void SrsSharedPtrMessage::set_rtp_packets(const std::vector<SrsRtpSharedPacket*>& pkts)
 | 
			
		||||
{
 | 
			
		||||
    rtp_packets = pkts;
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
SrsFlvTransmuxer::SrsFlvTransmuxer()
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -288,7 +288,10 @@ public:
 | 
			
		|||
    //       video/audio packet use raw bytes, no video/audio packet.
 | 
			
		||||
    char* payload;
 | 
			
		||||
 | 
			
		||||
#ifdef SRS_AUTO_RTC
 | 
			
		||||
    std::vector<SrsRtpSharedPacket*> rtp_packets;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    class SrsSharedPtrPayload
 | 
			
		||||
    {
 | 
			
		||||
| 
						 | 
				
			
			@ -344,7 +347,9 @@ public:
 | 
			
		|||
    // @remark, assert object is created.
 | 
			
		||||
    virtual SrsSharedPtrMessage* copy();
 | 
			
		||||
public:
 | 
			
		||||
#ifdef SRS_AUTO_RTC
 | 
			
		||||
    virtual void set_rtp_packets(const std::vector<SrsRtpSharedPacket*>& pkts);
 | 
			
		||||
#endif
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// Transmux RTMP packets to FLV stream.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -50,7 +50,9 @@ using namespace std;
 | 
			
		|||
#include <srs_core_autofree.hpp>
 | 
			
		||||
#include <srs_kernel_file.hpp>
 | 
			
		||||
#include <srs_app_hybrid.hpp>
 | 
			
		||||
#ifdef SRS_AUTO_RTC
 | 
			
		||||
#include <srs_app_rtc_conn.hpp>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef SRS_AUTO_SRT
 | 
			
		||||
#include <srt_server.hpp>
 | 
			
		||||
| 
						 | 
				
			
			@ -449,7 +451,9 @@ srs_error_t run_hybrid_server()
 | 
			
		|||
    _srs_hybrid->register_server(new SrtServerAdapter());
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef SRS_AUTO_RTC
 | 
			
		||||
    _srs_hybrid->register_server(new RtcServerAdapter());
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
    // Do some system initialize.
 | 
			
		||||
    if ((err = _srs_hybrid->initialize()) != srs_success) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue