Skip to content

Commit

Permalink
Added system library option for ffmpeg, srtp, srt libraries. v5.0.193…
Browse files Browse the repository at this point in the history
… v6.0.93 (#3846)

---------

Co-authored-by: john <hondaxiao@tencent.com>
  • Loading branch information
duiniuluantanqin and xiaozhihong authored Oct 20, 2023
1 parent 4e7c075 commit 9183e05
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 8 deletions.
17 changes: 13 additions & 4 deletions trunk/auto/depends.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down
34 changes: 32 additions & 2 deletions trunk/auto/options.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand All @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 ;;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)"
Expand All @@ -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)"
Expand All @@ -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)"
Expand Down
15 changes: 15 additions & 0 deletions trunk/configure
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions trunk/doc/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The changelog for SRS.
<a name="v6-changes"></a>

## 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)
Expand Down Expand Up @@ -104,6 +105,7 @@ The changelog for SRS.
<a name="v5-changes"></a>

## 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)
Expand Down
2 changes: 1 addition & 1 deletion trunk/src/core/srs_core_version5.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

#define VERSION_MAJOR 5
#define VERSION_MINOR 0
#define VERSION_REVISION 192
#define VERSION_REVISION 193

#endif
2 changes: 1 addition & 1 deletion trunk/src/core/srs_core_version6.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@

#define VERSION_MAJOR 6
#define VERSION_MINOR 0
#define VERSION_REVISION 92
#define VERSION_REVISION 93

#endif

0 comments on commit 9183e05

Please sign in to comment.