diff --git a/trunk/auto/depends.sh b/trunk/auto/depends.sh index ea7d834f67..8c33d58395 100755 --- a/trunk/auto/depends.sh +++ b/trunk/auto/depends.sh @@ -444,7 +444,10 @@ fi ##################################################################################### # srtp ##################################################################################### -if [[ $SRS_RTC == YES ]]; then +if [[ $SRS_RTC == YES && $SRS_USE_SYS_SRTP == YES ]]; then + echo "Warning: Use system libsrtp, without compiling srtp." +fi +if [[ $SRS_RTC == YES && $SRS_USE_SYS_SRTP == NO ]]; then SRTP_OPTIONS="" # To eliminate warnings, see https://stackoverflow.com/a/34208904/17679565 # was built for newer macOS version (11.6) than being linked (11.0) @@ -513,7 +516,7 @@ fi # For cross build, we use opus of FFmpeg, so we don't build the libopus. if [[ $SRS_RTC == YES && $SRS_FFMPEG_OPUS != YES ]]; then # Only build static libraries if no shared FFmpeg. - if [[ $SRS_SHARED_FFMPEG == NO ]]; then + if [[ $SRS_SHARED_FFMPEG != YES ]]; then OPUS_OPTIONS="--disable-shared --disable-doc" fi if [[ $OS_IS_LOONGARCH64 == YES ]]; then @@ -542,7 +545,10 @@ fi ##################################################################################### # ffmpeg-fit, for WebRTC to transcode AAC with Opus. ##################################################################################### -if [[ $SRS_FFMPEG_FIT == YES ]]; then +if [[ $SRS_FFMPEG_FIT == YES && $SRS_USE_SYS_FFMPEG == YES ]]; then + echo "Warning: Use system ffmpeg, without compiling ffmpeg." +fi +if [[ $SRS_FFMPEG_FIT == YES && $SRS_USE_SYS_FFMPEG == NO ]]; then FFMPEG_CONFIGURE="env SRS_FFMPEG_FIT=on" if [[ $SRS_FFMPEG_OPUS != YES ]]; then FFMPEG_CONFIGURE="$FFMPEG_CONFIGURE PKG_CONFIG_PATH=${SRS_DEPENDS_LIBS}/opus/lib/pkgconfig" @@ -659,7 +665,10 @@ fi ##################################################################################### # SRT module, https://github.com/ossrs/srs/issues/1147#issuecomment-577469119 ##################################################################################### -if [[ $SRS_SRT == YES ]]; then +if [[ $SRS_SRT == YES && $SRS_USE_SYS_SRT == YES ]]; then + echo "Warning: Use system libsrt, without compiling srt." +fi +if [[ $SRS_SRT == YES && $SRS_USE_SYS_SRT == NO ]]; then # Always disable c++11 for libsrt, because only the srt-app requres it. LIBSRT_OPTIONS="--enable-apps=0 --enable-static=1 --enable-c++11=0" if [[ $SRS_SHARED_SRT == YES ]]; then diff --git a/trunk/auto/options.sh b/trunk/auto/options.sh index 5724ce8185..c90e97dce9 100755 --- a/trunk/auto/options.sh +++ b/trunk/auto/options.sh @@ -50,10 +50,13 @@ SRS_STATIC=NO SRS_SHARED_ST=NO # If enabled, link shared libraries for libsrt.so which uses MPL license. # See https://ossrs.net/lts/zh-cn/license#srt -SRS_SHARED_SRT=NO +SRS_SHARED_SRT=RESERVED # If enabled, link shared libraries for FFmpeg which is LGPL license. # See https://ossrs.net/lts/zh-cn/license#ffmpeg -SRS_SHARED_FFMPEG=NO +SRS_SHARED_FFMPEG=RESERVED +# If enabled, link shared libraries for SRTP which is BSD license. +# See https://ossrs.net/lts/zh-cn/license#srtp +SRS_SHARED_SRTP=RESERVED # whether enable the gcov SRS_GCOV=NO # Whether enable cloud logging and APM(Application Performance Monitor). @@ -69,6 +72,9 @@ SRS_LOG_LEVEL_V2=YES ################################################################ # Experts options. SRS_USE_SYS_SSL=NO # Use system ssl(-lssl) if required. +SRS_USE_SYS_FFMPEG=NO # Use system ffmpeg if required. +SRS_USE_SYS_SRT=NO # Use system srt(-lsrt) if required. +SRS_USE_SYS_SRTP=NO # Use system srtp(-lsrtp) if required. SRS_VALGRIND=NO SRS_SANITIZER=RESERVED SRS_SANITIZER_STATIC=NO @@ -215,7 +221,11 @@ Experts: --ssl-local=on|off Whether use local openssl, not system even exists. Default: $(value2switch $SRS_SSL_LOCAL) --shared-st=on|off Use shared libraries for ST which is MPL license. Default: $(value2switch $SRS_SHARED_ST) --shared-srt=on|off Use shared libraries for SRT which is MPL license. Default: $(value2switch $SRS_SHARED_SRT) + --sys-srt=on|off Do not compile srt, use system srt(-lsrt) if required. Default: $(value2switch $SRS_USE_SYS_SRT) --shared-ffmpeg=on|off Use shared libraries for FFmpeg which is LGPL license. Default: $(value2switch $SRS_SHARED_FFMPEG) + --sys-ffmpeg=on|off Do not compile ffmpeg, use system ffmpeg if required. Default: $(value2switch $SRS_USE_SYS_FFMPEG) + --sys-srtp=on|off Do not compile srtp, use system srtp(-lsrtp) if required. Default: $(value2switch $SRS_USE_SYS_SRTP) + --shared-srtp=on|off Use shared libraries for SRTP which is BSD license. Default: $(value2switch $SRS_SHARED_SRTP) --clean=on|off Whether do 'make clean' when configure. Default: $(value2switch $SRS_CLEAN) --simulator=on|off RTC: Whether enable network simulator. Default: $(value2switch $SRS_SIMULATOR) --generate-objs=on|off RTC: Whether generate objs and quit. Default: $(value2switch $SRS_GENERATE_OBJS) @@ -398,7 +408,14 @@ function parse_user_option() { --use-shared-srt) SRS_SHARED_SRT=YES ;; --shared-st) SRS_SHARED_ST=$(switch2value $value) ;; --shared-srt) SRS_SHARED_SRT=$(switch2value $value) ;; + --use-sys-srt) SRS_USE_SYS_SRT=YES ;; + --sys-srt) SRS_USE_SYS_SRT=$(switch2value $value) ;; --shared-ffmpeg) SRS_SHARED_FFMPEG=$(switch2value $value) ;; + --use-sys-ffmpeg) SRS_USE_SYS_FFMPEG=YES ;; + --sys-ffmpeg) SRS_USE_SYS_FFMPEG=$(switch2value $value) ;; + --shared-srtp) SRS_SHARED_SRTP=$(switch2value $value) ;; + --use-sys-srtp) SRS_USE_SYS_SRTP=YES ;; + --sys-srtp) SRS_USE_SYS_SRTP=$(switch2value $value) ;; --with-valgrind) SRS_VALGRIND=YES ;; --without-valgrind) SRS_VALGRIND=NO ;; @@ -521,10 +538,19 @@ function apply_auto_options() { if [[ $SRS_RTC == YES && $SRS_FFMPEG_FIT == RESERVED ]]; then SRS_FFMPEG_FIT=YES fi + if [[ $SRS_USE_SYS_FFMPEG == YES && $SRS_SHARED_FFMPEG == RESERVED ]]; then + SRS_SHARED_FFMPEG=YES + fi if [[ $SRS_CROSS_BUILD == YES && $SRS_FFMPEG_OPUS != YES ]]; then echo "Enable FFmpeg native opus for cross building" SRS_FFMPEG_OPUS=YES fi + if [[ $SRS_USE_SYS_SRT == YES && $SRS_SHARED_SRT == RESERVED ]]; then + SRS_SHARED_SRT=YES + fi + if [[ $SRS_USE_SYS_SRTP == YES && $SRS_SHARED_SRTP == RESERVED ]]; then + SRS_SHARED_SRTP=YES + fi # Enable asan, but disable for Centos # @see https://github.com/ossrs/srs/issues/3347 @@ -628,6 +654,7 @@ function regenerate_options() { SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --http-api=$(value2switch $SRS_HTTP_API)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --utest=$(value2switch $SRS_UTEST)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --srt=$(value2switch $SRS_SRT)" + SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --sys-srt=$(value2switch $SRS_USE_SYS_SRT)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --rtc=$(value2switch $SRS_RTC)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --h265=$(value2switch $SRS_H265)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --gb28181=$(value2switch $SRS_GB28181)" @@ -636,9 +663,11 @@ function regenerate_options() { SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cxx14=$(value2switch $SRS_CXX14)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --backtrace=$(value2switch $SRS_BACKTRACE)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --ffmpeg-fit=$(value2switch $SRS_FFMPEG_FIT)" + SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --sys-ffmpeg=$(value2switch $SRS_USE_SYS_FFMPEG)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --ffmpeg-opus=$(value2switch $SRS_FFMPEG_OPUS)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --nasm=$(value2switch $SRS_NASM)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --srtp-nasm=$(value2switch $SRS_SRTP_ASM)" + SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --sys-srtp=$(value2switch $SRS_USE_SYS_SRTP)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --clean=$(value2switch $SRS_CLEAN)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --gperf=$(value2switch $SRS_GPERF)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --gmc=$(value2switch $SRS_GPERF_MC)" @@ -650,6 +679,7 @@ function regenerate_options() { SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --shared-st=$(value2switch $SRS_SHARED_ST)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --shared-srt=$(value2switch $SRS_SHARED_SRT)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --shared-ffmpeg=$(value2switch $SRS_SHARED_FFMPEG)" + SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --shared-srtp=$(value2switch $SRS_SHARED_SRTP)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --log-verbose=$(value2switch $SRS_LOG_VERBOSE)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --log-info=$(value2switch $SRS_LOG_INFO)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --log-trace=$(value2switch $SRS_LOG_TRACE)" diff --git a/trunk/configure b/trunk/configure index cfa2e93f48..1a1f4ead23 100755 --- a/trunk/configure +++ b/trunk/configure @@ -152,6 +152,10 @@ if [[ $SRS_SHARED_ST == YES ]]; then LibSTfile="-L${LibSTRoot} -lst"; fi # srtp if [[ $SRS_RTC == YES ]]; then LibSrtpRoot="${SRS_OBJS}/srtp2/include"; LibSrtpFile="${SRS_OBJS}/srtp2/lib/libsrtp2.a" + if [[ $SRS_USE_SYS_SRTP == YES ]]; then + LibSrtpRoot=""; LibSrtpFile="libsrtp2.a" + if [[ $SRS_SHARED_SRTP == YES ]]; then LibSrtpFile="-lsrtp2"; fi + fi fi # FFMPEG for WebRTC transcoding, such as aac to opus. @@ -167,6 +171,13 @@ if [[ $SRS_FFMPEG_FIT == YES ]]; then LibFfmpegFile="$LibFfmpegFile -L${SRS_OBJS}/opus/lib -lopus" fi fi + if [[ $SRS_USE_SYS_FFMPEG == YES ]]; then + LibFfmpegRoot="" + LibFfmpegFile="libavcodec.a libswresample.a libavutil.a libopus.a"; + if [[ $SRS_SHARED_FFMPEG == YES ]]; then + LibFfmpegFile="-lavcodec -lswresample -lavutil -lopus" + fi + fi fi # openssl-1.1.0e, for the RTMP complex handshake. @@ -188,6 +199,10 @@ fi if [[ $SRS_SRT == YES ]]; then LibSRTRoot="${SRS_OBJS}/srt/include"; LibSRTfile="${SRS_OBJS}/srt/lib/libsrt.a" if [[ $SRS_SHARED_SRT == YES ]]; then LibSRTfile="-L${SRS_OBJS}/srt/lib -lsrt"; fi + if [[ $SRS_USE_SYS_SRT == YES ]]; then + LibSRTRoot=""; LibSRTfile="libsrt.a" + if [[ $SRS_SHARED_SRT == YES ]]; then LibSRTfile="-lsrt"; fi + fi fi # the link options, always use static link diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index b39cfcc9e2..446d841097 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -7,6 +7,7 @@ The changelog for SRS. ## SRS 6.0 Changelog +* v6.0, 2023-10-20, Merge [#3846](https://github.com/ossrs/srs/pull/3846): Added system library option for ffmpeg, srtp, srt libraries. v6.0.93 (#3846) * v6.0, 2023-10-17, Merge [#3840](https://github.com/ossrs/srs/pull/3840): Disable asan by default. v6.0.92 (#3840) * v6.0, 2023-10-17, Merge [#3837](https://github.com/ossrs/srs/pull/3837): Support set the ice-ufrag and ice-pwd for connectivity check. v6.0.91 (#3837) * v6.0, 2023-10-17, Merge [#3758](https://github.com/ossrs/srs/pull/3758): Refine docker detect mechenism. v6.0.90 (#3758) @@ -104,6 +105,7 @@ The changelog for SRS. ## SRS 5.0 Changelog +* v5.0, 2023-10-20, Merge [#3846](https://github.com/ossrs/srs/pull/3846): Added system library option for ffmpeg, srtp, srt libraries. v5.0.193 (#3846) * v5.0, 2023-10-17, Merge [#3840](https://github.com/ossrs/srs/pull/3840): Disable asan by default. v5.0.192 (#3840) * v5.0, 2023-10-17, Merge [#3837](https://github.com/ossrs/srs/pull/3837): Support set the ice-ufrag and ice-pwd for connectivity check. v5.0.191 (#3837) * v5.0, 2023-10-17, Merge [#3758](https://github.com/ossrs/srs/pull/3758): Refine docker detect mechenism. v5.0.190 (#3758) diff --git a/trunk/src/core/srs_core_version5.hpp b/trunk/src/core/srs_core_version5.hpp index fe243b07b7..70aab655db 100644 --- a/trunk/src/core/srs_core_version5.hpp +++ b/trunk/src/core/srs_core_version5.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 5 #define VERSION_MINOR 0 -#define VERSION_REVISION 192 +#define VERSION_REVISION 193 #endif diff --git a/trunk/src/core/srs_core_version6.hpp b/trunk/src/core/srs_core_version6.hpp index e045d9fbfd..ab87bb170b 100644 --- a/trunk/src/core/srs_core_version6.hpp +++ b/trunk/src/core/srs_core_version6.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 6 #define VERSION_MINOR 0 -#define VERSION_REVISION 92 +#define VERSION_REVISION 93 #endif