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

For #1659, #307, add switch to disable rtc

This commit is contained in:
winlin 2020-03-22 18:17:05 +08:00
parent 37c84eccc0
commit 602a478e1b
12 changed files with 133 additions and 28 deletions

View file

@ -5,7 +5,7 @@ jobs:
- image: ossrs/srs:dev - image: ossrs/srs:dev
steps: steps:
- checkout - checkout
- run: cd trunk && ./configure && make - run: cd trunk && ./configure --without-rtc && make && ./configure && make
test: test:
docker: docker:
- image: ossrs/srs:dev - image: ossrs/srs:dev

View file

@ -73,6 +73,12 @@ else
srs_undefine_macro "SRS_AUTO_SRT" $SRS_AUTO_HEADERS_H srs_undefine_macro "SRS_AUTO_SRT" $SRS_AUTO_HEADERS_H
fi 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 if [ $SRS_MEM_WATCH = YES ]; then
srs_define_macro "SRS_AUTO_MEM_WATCH" $SRS_AUTO_HEADERS_H srs_define_macro "SRS_AUTO_MEM_WATCH" $SRS_AUTO_HEADERS_H
else else

View file

@ -399,7 +399,7 @@ fi
##################################################################################### #####################################################################################
# libopus, for WebRTC to transcode AAC with Opus. # 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 if [[ -f ${SRS_OBJS}/opus/lib/libopus.a ]]; then
echo "The opus-1.3.1 is ok."; echo "The opus-1.3.1 is ok.";
else else
@ -419,7 +419,7 @@ fi
##################################################################################### #####################################################################################
# ffmpeg-fix, for WebRTC to transcode AAC with Opus. # 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 if [[ -f ${SRS_OBJS}/ffmpeg/lib/libavcodec.a ]]; then
echo "The ffmpeg-4.2-fit is ok."; echo "The ffmpeg-4.2-fit is ok.";
else else

View file

@ -17,6 +17,7 @@ help=no
# feature options # feature options
SRS_HDS=NO SRS_HDS=NO
SRS_SRT=NO SRS_SRT=NO
SRS_RTC=YES
SRS_NGINX=NO SRS_NGINX=NO
SRS_FFMPEG_TOOL=NO SRS_FFMPEG_TOOL=NO
SRS_LIBRTMP=NO SRS_LIBRTMP=NO
@ -130,7 +131,8 @@ Features:
--with-librtmp Enable srs-librtmp, library for client. --with-librtmp Enable srs-librtmp, library for client.
--with-research Build the research tools. --with-research Build the research tools.
--with-utest Build the utest for SRS. --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-ssl Disable rtmp complex handshake.
--without-hds Disable hds, the adobe http dynamic streaming. --without-hds Disable hds, the adobe http dynamic streaming.
@ -139,7 +141,8 @@ Features:
--without-librtmp Disable srs-librtmp, library for client. --without-librtmp Disable srs-librtmp, library for client.
--without-research Do not build the research tools. --without-research Do not build the research tools.
--without-utest Do not build the utest for SRS. --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 --prefix=<path> The absolute installation path for srs. Default: $SRS_PREFIX
--static Whether add '-static' to link options. --static Whether add '-static' to link options.
@ -225,6 +228,7 @@ function parse_user_option() {
--with-research) SRS_RESEARCH=YES ;; --with-research) SRS_RESEARCH=YES ;;
--with-utest) SRS_UTEST=YES ;; --with-utest) SRS_UTEST=YES ;;
--with-srt) SRS_SRT=YES ;; --with-srt) SRS_SRT=YES ;;
--with-rtc) SRS_RTC=YES ;;
--with-gperf) SRS_GPERF=YES ;; --with-gperf) SRS_GPERF=YES ;;
--with-gmc) SRS_GPERF_MC=YES ;; --with-gmc) SRS_GPERF_MC=YES ;;
--with-gmd) SRS_GPERF_MD=YES ;; --with-gmd) SRS_GPERF_MD=YES ;;
@ -240,7 +244,8 @@ function parse_user_option() {
--without-librtmp) SRS_LIBRTMP=NO ;; --without-librtmp) SRS_LIBRTMP=NO ;;
--without-research) SRS_RESEARCH=NO ;; --without-research) SRS_RESEARCH=NO ;;
--without-utest) SRS_UTEST=NO ;; --without-utest) SRS_UTEST=NO ;;
--without-srt) SRS_SRT=NO ;; --without-srt) SRS_SRT=NO ;;
--without-rtc) SRS_RTC=NO ;;
--without-gperf) SRS_GPERF=NO ;; --without-gperf) SRS_GPERF=NO ;;
--without-gmc) SRS_GPERF_MC=NO ;; --without-gmc) SRS_GPERF_MC=NO ;;
--without-gmd) SRS_GPERF_MD=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_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_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_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 = 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_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 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
View file

@ -149,10 +149,14 @@ END
LibSTRoot="${SRS_OBJS_DIR}/st"; LibSTfile="${LibSTRoot}/libst.a" LibSTRoot="${SRS_OBJS_DIR}/st"; LibSTfile="${LibSTRoot}/libst.a"
if [[ $SRS_SHARED_ST == YES ]]; then LibSTfile="-lst"; fi if [[ $SRS_SHARED_ST == YES ]]; then LibSTfile="-lst"; fi
# srtp # srtp
LibSrtpRoot="${SRS_OBJS_DIR}/srtp2/include"; LibSrtpFile="${SRS_OBJS_DIR}/srtp2/lib/libsrtp2.a" if [[ $SRS_RTC == YES ]]; then
# ffmpeg LibSrtpRoot="${SRS_OBJS_DIR}/srtp2/include"; LibSrtpFile="${SRS_OBJS_DIR}/srtp2/lib/libsrtp2.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 -lpthread" fi
LibFfmpegRoot="${LibFfmpegRoot} ${SRS_OBJS_DIR}/opus/include"; LibFfmpegFile="${LibFfmpegFile} ${SRS_OBJS_DIR}/opus/lib/libopus.a" # 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. # openssl-1.1.0e, for the RTMP complex handshake.
LibSSLRoot="";LibSSLfile="" LibSSLRoot="";LibSSLfile=""
if [[ $SRS_SSL == YES && $SRS_USE_SYS_SSL == NO ]]; then if [[ $SRS_SSL == YES && $SRS_USE_SYS_SSL == NO ]]; then
@ -173,7 +177,7 @@ if [[ $SRS_SRT == YES ]]; then
fi fi
# the link options, always use static link # the link options, always use static link
SrsLinkOptions="-ldl"; SrsLinkOptions="-ldl";
if [[ $SRS_SRT == YES ]]; then if [[ $SRS_SRT == YES || $SRS_RTC == YES ]]; then
SrsLinkOptions="${SrsLinkOptions} -lpthread"; SrsLinkOptions="${SrsLinkOptions} -lpthread";
fi fi
if [[ $SRS_SSL == YES && $SRS_USE_SYS_SSL == YES ]]; then if [[ $SRS_SSL == YES && $SRS_USE_SYS_SSL == YES ]]; then
@ -206,9 +210,12 @@ MODULE_ID="KERNEL"
MODULE_DEPENDS=("CORE") MODULE_DEPENDS=("CORE")
ModuleLibIncs=(${SRS_OBJS_DIR} ${LibSSLRoot}) ModuleLibIncs=(${SRS_OBJS_DIR} ${LibSSLRoot})
MODULE_FILES=("srs_kernel_error" "srs_kernel_log" "srs_kernel_buffer" 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_consts" "srs_kernel_aac" "srs_kernel_mp3" "srs_kernel_ts"
"srs_kernel_stream" "srs_kernel_balance" "srs_kernel_mp4" "srs_kernel_file") "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_INCS="src/kernel"; MODULE_DIR=${KERNEL_INCS} . auto/modules.sh
KERNEL_OBJS="${MODULE_OBJS[@]}" KERNEL_OBJS="${MODULE_OBJS[@]}"
# #
@ -219,7 +226,10 @@ ModuleLibIncs=(${SRS_OBJS_DIR} ${LibSSLRoot})
MODULE_FILES=("srs_protocol_amf0" "srs_protocol_io" "srs_rtmp_stack" 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_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_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_INCS="src/protocol"; MODULE_DIR=${PROTOCOL_INCS} . auto/modules.sh
PROTOCOL_OBJS="${MODULE_OBJS[@]}" PROTOCOL_OBJS="${MODULE_OBJS[@]}"
# #
@ -238,7 +248,10 @@ fi
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
MODULE_ID="SERVICE" MODULE_ID="SERVICE"
MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL") 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" 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_http_conn" "srs_service_rtmp_conn" "srs_service_utility"
"srs_service_conn") "srs_service_conn")
@ -251,7 +264,10 @@ fi
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
MODULE_ID="APP" MODULE_ID="APP"
MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "SERVICE") 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" 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"
"srs_app_thread" "srs_app_bandwidth" "srs_app_st" "srs_app_log" "srs_app_config" "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_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_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_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_caster_flv" "srs_app_process" "srs_app_ng_exec"
"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_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="" DEFINES=""
# add each modules for app # add each modules for app
for SRS_MODULE in ${SRS_MODULES[*]}; do for SRS_MODULE in ${SRS_MODULES[*]}; do
@ -289,7 +308,10 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
if [[ $SRS_SRT == YES ]]; then if [[ $SRS_SRT == YES ]]; then
MODULE_DEPENDS+=("SRT") MODULE_DEPENDS+=("SRT")
fi 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 if [[ $SRS_SRT == YES ]]; then
ModuleLibIncs+=("${LibSRTRoot[*]}") ModuleLibIncs+=("${LibSRTRoot[*]}")
fi fi
@ -302,7 +324,10 @@ fi
if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
MODULE_ID="MAIN" MODULE_ID="MAIN"
MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "SERVICE") 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=() MODULE_FILES=()
DEFINES="" DEFINES=""
# add each modules for main # add each modules for main
@ -329,13 +354,19 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
done done
# #
# all depends libraries # 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 if [[ $SRS_SRT == YES ]]; then
ModuleLibFiles+=("${LibSRTfile[*]}") ModuleLibFiles+=("${LibSRTfile[*]}")
fi fi
# all depends objects # all depends objects
MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${PROTOCOL_OBJS[@]} ${SERVICE_OBJS[@]} ${APP_OBJS[@]} ${SERVER_OBJS[@]}" 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 if [[ $SRS_SRT == YES ]]; then
MODULE_OBJS="${MODULE_OBJS} ${SRT_OBJS[@]}" MODULE_OBJS="${MODULE_OBJS} ${SRT_OBJS[@]}"
fi fi
@ -346,7 +377,10 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
# #
# For modules, without the app module. # For modules, without the app module.
MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${PROTOCOL_OBJS[@]} ${SERVICE_OBJS[@]} ${MAIN_OBJS[@]}" 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 for SRS_MODULE in ${SRS_MODULES[*]}; do
. $SRS_MODULE/config . $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" 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_config" "srs_utest_rtmp" "srs_utest_http" "srs_utest_avc" "srs_utest_reload"
"srs_utest_mp4" "srs_utest_service" "srs_utest_app") "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 if [[ $SRS_SRT == YES ]]; then
ModuleLibIncs+=("${LibSRTRoot[*]}") ModuleLibIncs+=("${LibSRTRoot[*]}")
fi fi
ModuleLibFiles=(${LibSTfile} ${LibSrtpFile} ${LibFfmpegFile} ${LibSSLfile}) ModuleLibFiles=(${LibSTfile} ${LibSSLfile})
if [[ $SRS_RTC == YES ]]; then
ModuleLibFiles+=("${LibFfmpegFile[*]}" ${LibSrtpFile})
fi
if [[ $SRS_SRT == YES ]]; then if [[ $SRS_SRT == YES ]]; then
ModuleLibFiles+=("${LibSRTfile[*]}") ModuleLibFiles+=("${LibSRTfile[*]}")
fi fi

View file

@ -46,7 +46,9 @@ using namespace std;
#include <srs_protocol_amf0.hpp> #include <srs_protocol_amf0.hpp>
#include <srs_protocol_utility.hpp> #include <srs_protocol_utility.hpp>
#include <srs_app_coworkers.hpp> #include <srs_app_coworkers.hpp>
#ifdef SRS_AUTO_RTC
#include <srs_app_rtc_conn.hpp> #include <srs_app_rtc_conn.hpp>
#endif
srs_error_t srs_api_response_jsonp(ISrsHttpResponseWriter* w, string callback, string data) 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()); return srs_api_response(w, r, obj->dumps());
} }
#ifdef SRS_AUTO_RTC
SrsGoApiSdp::SrsGoApiSdp(SrsRtcServer* rtc_svr) SrsGoApiSdp::SrsGoApiSdp(SrsRtcServer* rtc_svr)
{ {
rtc_server = rtc_svr; rtc_server = rtc_svr;
@ -907,6 +910,7 @@ srs_error_t SrsGoApiSdp::do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessag
return err; return err;
} }
#endif
SrsGoApiClients::SrsGoApiClients() SrsGoApiClients::SrsGoApiClients()
{ {

View file

@ -166,6 +166,7 @@ public:
virtual srs_error_t serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r); virtual srs_error_t serve_http(ISrsHttpResponseWriter* w, ISrsHttpMessage* r);
}; };
#ifdef SRS_AUTO_RTC
class SrsGoApiSdp : public ISrsHttpHandler class SrsGoApiSdp : public ISrsHttpHandler
{ {
private: private:
@ -178,6 +179,7 @@ public:
private: 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
class SrsGoApiClients : public ISrsHttpHandler class SrsGoApiClients : public ISrsHttpHandler
{ {

View file

@ -33,7 +33,6 @@ using namespace std;
#include <srs_kernel_codec.hpp> #include <srs_kernel_codec.hpp>
#include <srs_kernel_rtp.hpp> #include <srs_kernel_rtp.hpp>
#include <srs_app_hls.hpp> #include <srs_app_hls.hpp>
#include <srs_app_rtc.hpp>
#include <srs_app_forward.hpp> #include <srs_app_forward.hpp>
#include <srs_app_config.hpp> #include <srs_app_config.hpp>
#include <srs_app_encoder.hpp> #include <srs_app_encoder.hpp>
@ -51,6 +50,9 @@ using namespace std;
#include <srs_app_ng_exec.hpp> #include <srs_app_ng_exec.hpp>
#include <srs_app_dash.hpp> #include <srs_app_dash.hpp>
#include <srs_protocol_format.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 250
#define CONST_MAX_JITTER_MS_NEG -250 #define CONST_MAX_JITTER_MS_NEG -250
@ -816,6 +818,7 @@ SrsSharedPtrMessage* SrsMixQueue::pop()
return msg; return msg;
} }
#ifdef SRS_AUTO_RTC
SrsRtpPacketQueue::SrsRtpPacketQueue() SrsRtpPacketQueue::SrsRtpPacketQueue()
{ {
} }
@ -864,6 +867,7 @@ SrsRtpSharedPacket* SrsRtpPacketQueue::find(const uint16_t& sequence)
return pkt; return pkt;
} }
#endif
SrsOriginHub::SrsOriginHub() SrsOriginHub::SrsOriginHub()
{ {
@ -875,7 +879,9 @@ SrsOriginHub::SrsOriginHub()
dash = new SrsDash(); dash = new SrsDash();
dvr = new SrsDvr(); dvr = new SrsDvr();
encoder = new SrsEncoder(); encoder = new SrsEncoder();
#ifdef SRS_AUTO_RTC
rtc = new SrsRtc(); rtc = new SrsRtc();
#endif
#ifdef SRS_AUTO_HDS #ifdef SRS_AUTO_HDS
hds = new SrsHds(); hds = new SrsHds();
#endif #endif
@ -919,10 +925,12 @@ srs_error_t SrsOriginHub::initialize(SrsSource* s, SrsRequest* r)
if ((err = format->initialize()) != srs_success) { if ((err = format->initialize()) != srs_success) {
return srs_error_wrap(err, "format initialize"); return srs_error_wrap(err, "format initialize");
} }
#ifdef SRS_AUTO_RTC
if ((err = rtc->initialize(this, req)) != srs_success) { if ((err = rtc->initialize(this, req)) != srs_success) {
return srs_error_wrap(err, "rtc initialize"); return srs_error_wrap(err, "rtc initialize");
} }
#endif
if ((err = hls->initialize(this, req)) != srs_success) { if ((err = hls->initialize(this, req)) != srs_success) {
return srs_error_wrap(err, "hls initialize"); 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]); srs_flv_srates[c->sound_rate]);
} }
#ifdef SRS_AUTO_RTC
if ((err = rtc->on_audio(msg, format)) != srs_success) { if ((err = rtc->on_audio(msg, format)) != srs_success) {
srs_warn("rtc: ignore audio error %s", srs_error_desc(err).c_str()); srs_warn("rtc: ignore audio error %s", srs_error_desc(err).c_str());
srs_error_reset(err); srs_error_reset(err);
rtc->on_unpublish(); rtc->on_unpublish();
} }
#endif
if ((err = hls->on_audio(msg, format)) != srs_success) { if ((err = hls->on_audio(msg, format)) != srs_success) {
// apply the error strategy for hls. // apply the error strategy for hls.
@ -1121,6 +1131,7 @@ srs_error_t SrsOriginHub::on_video(SrsSharedPtrMessage* shared_video, bool is_se
return err; return err;
} }
#ifdef SRS_AUTO_RTC
// Parse RTMP message to RTP packets, in FU-A if too large. // Parse RTMP message to RTP packets, in FU-A if too large.
if ((err = rtc->on_video(msg, format)) != srs_success) { if ((err = rtc->on_video(msg, format)) != srs_success) {
// TODO: We should support more strategies. // 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? // TODO: FIXME: Refactor to move to rtp?
// Save the RTP packets for find_rtp_packet() to rtx or restore it. // Save the RTP packets for find_rtp_packet() to rtx or restore it.
source->rtp_queue->push(msg->rtp_packets); source->rtp_queue->push(msg->rtp_packets);
#endif
if ((err = hls->on_video(msg, format)) != srs_success) { if ((err = hls->on_video(msg, format)) != srs_success) {
// TODO: We should support more strategies. // TODO: We should support more strategies.
@ -1200,10 +1212,12 @@ srs_error_t SrsOriginHub::on_publish()
if ((err = encoder->on_publish(req)) != srs_success) { if ((err = encoder->on_publish(req)) != srs_success) {
return srs_error_wrap(err, "encoder publish"); return srs_error_wrap(err, "encoder publish");
} }
#ifdef SRS_AUTO_RTC
if ((err = rtc->on_publish()) != srs_success) { if ((err = rtc->on_publish()) != srs_success) {
return srs_error_wrap(err, "rtc publish"); return srs_error_wrap(err, "rtc publish");
} }
#endif
if ((err = hls->on_publish()) != srs_success) { if ((err = hls->on_publish()) != srs_success) {
return srs_error_wrap(err, "hls publish"); return srs_error_wrap(err, "hls publish");
@ -1242,7 +1256,9 @@ void SrsOriginHub::on_unpublish()
destroy_forwarders(); destroy_forwarders();
encoder->on_unpublish(); encoder->on_unpublish();
#ifdef SRS_AUTO_RTC
rtc->on_unpublish(); rtc->on_unpublish();
#endif
hls->on_unpublish(); hls->on_unpublish();
dash->on_unpublish(); dash->on_unpublish();
dvr->on_unpublish(); dvr->on_unpublish();
@ -1904,7 +1920,9 @@ SrsSource::SrsSource()
jitter_algorithm = SrsRtmpJitterAlgorithmOFF; jitter_algorithm = SrsRtmpJitterAlgorithmOFF;
mix_correct = false; mix_correct = false;
mix_queue = new SrsMixQueue(); mix_queue = new SrsMixQueue();
#ifdef SRS_AUTO_RTC
rtp_queue = new SrsRtpPacketQueue(); rtp_queue = new SrsRtpPacketQueue();
#endif
_can_publish = true; _can_publish = true;
_pre_source_id = _source_id = -1; _pre_source_id = _source_id = -1;
@ -1934,7 +1952,9 @@ SrsSource::~SrsSource()
srs_freep(hub); srs_freep(hub);
srs_freep(meta); srs_freep(meta);
srs_freep(mix_queue); srs_freep(mix_queue);
#ifdef SRS_AUTO_RTC
srs_freep(rtp_queue); srs_freep(rtp_queue);
#endif
srs_freep(play_edge); srs_freep(play_edge);
srs_freep(publish_edge); srs_freep(publish_edge);
@ -2692,7 +2712,9 @@ string SrsSource::get_curr_origin()
return play_edge->get_curr_origin(); return play_edge->get_curr_origin();
} }
#ifdef SRS_AUTO_RTC
SrsRtpSharedPacket* SrsSource::find_rtp_packet(const uint16_t& seq) SrsRtpSharedPacket* SrsSource::find_rtp_packet(const uint16_t& seq)
{ {
return rtp_queue->find(seq); return rtp_queue->find(seq);
} }
#endif

View file

@ -325,6 +325,7 @@ public:
virtual SrsSharedPtrMessage* pop(); virtual SrsSharedPtrMessage* pop();
}; };
#ifdef SRS_AUTO_RTC
// To find the RTP packet for RTX or restore. // To find the RTP packet for RTX or restore.
class SrsRtpPacketQueue class SrsRtpPacketQueue
{ {
@ -347,6 +348,7 @@ public:
void insert(const uint16_t& sequence, SrsRtpSharedPacket* pkt); void insert(const uint16_t& sequence, SrsRtpSharedPacket* pkt);
SrsRtpSharedPacket* find(const uint16_t& sequence); SrsRtpSharedPacket* find(const uint16_t& sequence);
}; };
#endif
// The hub for origin is a collection of utilities for origin only, // The hub for origin is a collection of utilities for origin only,
// For example, DVR, HLS, Forward and Transcode are only available for origin, // For example, DVR, HLS, Forward and Transcode are only available for origin,
@ -360,8 +362,10 @@ private:
private: private:
// The format, codec information. // The format, codec information.
SrsRtmpFormat* format; SrsRtmpFormat* format;
#ifdef SRS_AUTO_RTC
// rtc handler // rtc handler
SrsRtc* rtc; SrsRtc* rtc;
#endif
// hls handler. // hls handler.
SrsHls* hls; SrsHls* hls;
// The DASH encoder. // The DASH encoder.
@ -534,8 +538,10 @@ private:
bool mix_correct; bool mix_correct;
// The mix queue to implements the mix correct algorithm. // The mix queue to implements the mix correct algorithm.
SrsMixQueue* mix_queue; SrsMixQueue* mix_queue;
#ifdef SRS_AUTO_RTC
// rtp packet queue // rtp packet queue
SrsRtpPacketQueue* rtp_queue; SrsRtpPacketQueue* rtp_queue;
#endif
// For play, whether enabled atc. // For play, whether enabled atc.
// The atc(use absolute time and donot adjust time), // The atc(use absolute time and donot adjust time),
// directly use msg time and donot adjust if atc is true, // directly use msg time and donot adjust if atc is true,
@ -625,8 +631,10 @@ public:
public: public:
virtual std::string get_curr_origin(); virtual std::string get_curr_origin();
public: public:
#ifdef SRS_AUTO_RTC
// Find rtp packet by sequence // Find rtp packet by sequence
SrsRtpSharedPacket* find_rtp_packet(const uint16_t& seq); SrsRtpSharedPacket* find_rtp_packet(const uint16_t& seq);
#endif
}; };
#endif #endif

View file

@ -36,11 +36,13 @@ using namespace std;
#include <srs_kernel_error.hpp> #include <srs_kernel_error.hpp>
#include <srs_kernel_buffer.hpp> #include <srs_kernel_buffer.hpp>
#include <srs_kernel_file.hpp> #include <srs_kernel_file.hpp>
#include <srs_kernel_rtp.hpp>
#include <srs_kernel_codec.hpp> #include <srs_kernel_codec.hpp>
#include <srs_kernel_utility.hpp> #include <srs_kernel_utility.hpp>
#include <srs_core_mem_watch.hpp> #include <srs_core_mem_watch.hpp>
#include <srs_core_autofree.hpp> #include <srs_core_autofree.hpp>
#ifdef SRS_AUTO_RTC
#include <srs_kernel_rtp.hpp>
#endif
SrsMessageHeader::SrsMessageHeader() SrsMessageHeader::SrsMessageHeader()
{ {
@ -230,9 +232,11 @@ SrsSharedPtrMessage::~SrsSharedPtrMessage()
} }
} }
#ifdef SRS_AUTO_RTC
for (int i = 0; i < (int)rtp_packets.size(); ++i) { for (int i = 0; i < (int)rtp_packets.size(); ++i) {
srs_freep(rtp_packets[i]); srs_freep(rtp_packets[i]);
} }
#endif
} }
srs_error_t SrsSharedPtrMessage::create(SrsCommonMessage* msg) srs_error_t SrsSharedPtrMessage::create(SrsCommonMessage* msg)
@ -351,17 +355,21 @@ SrsSharedPtrMessage* SrsSharedPtrMessage::copy()
copy->payload = ptr->payload; copy->payload = ptr->payload;
copy->size = ptr->size; copy->size = ptr->size;
#ifdef SRS_AUTO_RTC
for (int i = 0; i < (int)rtp_packets.size(); ++i) { for (int i = 0; i < (int)rtp_packets.size(); ++i) {
copy->rtp_packets.push_back(rtp_packets[i]->copy()); copy->rtp_packets.push_back(rtp_packets[i]->copy());
} }
#endif
return copy; return copy;
} }
#ifdef SRS_AUTO_RTC
void SrsSharedPtrMessage::set_rtp_packets(const std::vector<SrsRtpSharedPacket*>& pkts) void SrsSharedPtrMessage::set_rtp_packets(const std::vector<SrsRtpSharedPacket*>& pkts)
{ {
rtp_packets = pkts; rtp_packets = pkts;
} }
#endif
SrsFlvTransmuxer::SrsFlvTransmuxer() SrsFlvTransmuxer::SrsFlvTransmuxer()
{ {

View file

@ -288,7 +288,10 @@ public:
// video/audio packet use raw bytes, no video/audio packet. // video/audio packet use raw bytes, no video/audio packet.
char* payload; char* payload;
#ifdef SRS_AUTO_RTC
std::vector<SrsRtpSharedPacket*> rtp_packets; std::vector<SrsRtpSharedPacket*> rtp_packets;
#endif
private: private:
class SrsSharedPtrPayload class SrsSharedPtrPayload
{ {
@ -344,7 +347,9 @@ public:
// @remark, assert object is created. // @remark, assert object is created.
virtual SrsSharedPtrMessage* copy(); virtual SrsSharedPtrMessage* copy();
public: public:
#ifdef SRS_AUTO_RTC
virtual void set_rtp_packets(const std::vector<SrsRtpSharedPacket*>& pkts); virtual void set_rtp_packets(const std::vector<SrsRtpSharedPacket*>& pkts);
#endif
}; };
// Transmux RTMP packets to FLV stream. // Transmux RTMP packets to FLV stream.

View file

@ -50,7 +50,9 @@ using namespace std;
#include <srs_core_autofree.hpp> #include <srs_core_autofree.hpp>
#include <srs_kernel_file.hpp> #include <srs_kernel_file.hpp>
#include <srs_app_hybrid.hpp> #include <srs_app_hybrid.hpp>
#ifdef SRS_AUTO_RTC
#include <srs_app_rtc_conn.hpp> #include <srs_app_rtc_conn.hpp>
#endif
#ifdef SRS_AUTO_SRT #ifdef SRS_AUTO_SRT
#include <srt_server.hpp> #include <srt_server.hpp>
@ -449,7 +451,9 @@ srs_error_t run_hybrid_server()
_srs_hybrid->register_server(new SrtServerAdapter()); _srs_hybrid->register_server(new SrtServerAdapter());
#endif #endif
#ifdef SRS_AUTO_RTC
_srs_hybrid->register_server(new RtcServerAdapter()); _srs_hybrid->register_server(new RtcServerAdapter());
#endif
// Do some system initialize. // Do some system initialize.
if ((err = _srs_hybrid->initialize()) != srs_success) { if ((err = _srs_hybrid->initialize()) != srs_success) {