From ac50f55cd59d5fe4924a3d6b20e7e8616c7f851c Mon Sep 17 00:00:00 2001 From: Johnny Date: Fri, 31 Mar 2023 20:23:23 +0800 Subject: [PATCH] feat(sctp): update build script, usage configure --sctp=on, default off --- trunk/3rdparty/README.md | 4 + trunk/auto/auto_headers.sh | 7 + trunk/auto/depends.sh | 28 +++ trunk/auto/options.sh | 4 + trunk/research/console/en_index.html | 2 +- trunk/research/console/views/streams_en.html | 2 +- trunk/research/console/views/vhosts_en.html | 4 +- trunk/research/players/js/srs.page.js | 1 + trunk/research/players/rtc_datachannel.html | 178 +++++++++++++++++++ trunk/research/players/rtc_player.html | 1 + trunk/research/players/rtc_publisher.html | 1 + trunk/research/players/srs_gb28181.html | 1 + trunk/research/players/srs_player.html | 1 + 13 files changed, 230 insertions(+), 4 deletions(-) create mode 100644 trunk/research/players/rtc_datachannel.html diff --git a/trunk/3rdparty/README.md b/trunk/3rdparty/README.md index edb2a2a034..1e43453fdd 100644 --- a/trunk/3rdparty/README.md +++ b/trunk/3rdparty/README.md @@ -72,3 +72,7 @@ links: http://www.tortall.net/projects/yasm/releases/yasm-1.2.0.tar.gz * speex: http://downloads.xiph.org/releases/speex/speex-1.2rc1.tar.gz +* srtp: + https://github.com/cisco/libsrtp/releases/tag/v2.3.0 +* usrsctp: + https://github.com/sctplab/usrsctp diff --git a/trunk/auto/auto_headers.sh b/trunk/auto/auto_headers.sh index 1998a93745..b68c56929e 100755 --- a/trunk/auto/auto_headers.sh +++ b/trunk/auto/auto_headers.sh @@ -17,6 +17,7 @@ echo "#define SRS_BUILD_DATE \"`date \"+%Y-%m-%d %H:%M:%S\"`\"" >> $SRS_AUTO_HEA echo "#define SRS_UNAME \"`uname -a`\"" >> $SRS_AUTO_HEADERS_H echo "#define SRS_USER_CONFIGURE \"${SRS_AUTO_USER_CONFIGURE}\"" >> $SRS_AUTO_HEADERS_H echo "#define SRS_CONFIGURE \"${SRS_AUTO_CONFIGURE}\"" >> $SRS_AUTO_HEADERS_H +echo "#define GIT_COMMIT_ID \"`git rev-parse --short HEAD`\"" >> $SRS_AUTO_HEADERS_H echo "" >> $SRS_AUTO_HEADERS_H function srs_define_macro() @@ -104,6 +105,12 @@ else srs_undefine_macro "SRS_SIMULATOR" $SRS_AUTO_HEADERS_H fi +if [[ $SRS_SCTP == YES ]]; then + srs_define_macro "SRS_SCTP" $SRS_AUTO_HEADERS_H +else + srs_undefine_macro "SRS_SCTP" $SRS_AUTO_HEADERS_H +fi + if [[ $SRS_HTTPS == YES ]]; then srs_define_macro "SRS_HTTPS" $SRS_AUTO_HEADERS_H else diff --git a/trunk/auto/depends.sh b/trunk/auto/depends.sh index 716e5dfd18..ed2237b0db 100755 --- a/trunk/auto/depends.sh +++ b/trunk/auto/depends.sh @@ -529,6 +529,34 @@ if [[ $SRS_RTC == YES ]]; then ret=$?; if [[ $ret -ne 0 ]]; then echo "Build libsrtp failed, ret=$ret"; exit $ret; fi fi + + +##################################################################################### +# sctp, for WebRTC datachannel +##################################################################################### +# aclocal +# https://github.com/Homebrew/homebrew-core/issues/21125 +# brew install automake + +if [[ $SRS_SCTP == YES ]]; then + if [[ -f ${SRS_OBJS}/${SRS_PLATFORM}/sctp/lib/libusrsctp.a ]]; then + echo "The usrsctp is ok."; + else + echo "Building usrsctp."; + ( + rm -rf ${SRS_OBJS}/${SRS_PLATFORM}/usrsctp && cd ${SRS_OBJS}/${SRS_PLATFORM} && + mkdir -p usrsctp && cd usrsctp && cp -R ../../../3rdparty/usrsctp/* . && + ./bootstrap && ./configure --prefix=`pwd`/_release --enable-static --disable-shared && make ${SRS_JOBS} && make install + cd .. && rm -rf sctp && ln -sf usrsctp/_release sctp + ) + fi + # check status + ret=$?; if [[ $ret -ne 0 ]]; then echo "Build usrsctp failed, ret=$ret"; exit $ret; fi + # Always update the links. + (cd ${SRS_OBJS} && rm -rf sctp && ln -sf ${SRS_PLATFORM}/usrsctp/_release sctp) + if [ ! -f ${SRS_OBJS}/sctp/lib/libusrsctp.a ]; then echo "Build usrsctp failed."; exit -1; fi +fi + ##################################################################################### # libopus, for WebRTC to transcode AAC with Opus. ##################################################################################### diff --git a/trunk/auto/options.sh b/trunk/auto/options.sh index cdb807dd70..3349157065 100755 --- a/trunk/auto/options.sh +++ b/trunk/auto/options.sh @@ -8,6 +8,7 @@ SRS_SRT=YES SRS_RTC=YES SRS_H265=NO SRS_GB28181=NO +SRS_SCTP=NO SRS_CXX11=YES SRS_CXX14=NO SRS_BACKTRACE=YES @@ -169,6 +170,7 @@ Features: --srt=on|off Whether build the SRT. Default: $(value2switch $SRS_SRT) --rtc=on|off Whether build the WebRTC. Default: $(value2switch $SRS_RTC) --gb28181=on|off Whether build the GB28181. Default: $(value2switch $SRS_GB28181) + --sctp=on|off Whether build the SCTP for DataChannel. Default: $(value2switch $SRS_SCTP) --cxx11=on|off Whether enable the C++11. Default: $(value2switch $SRS_CXX11) --cxx14=on|off Whether enable the C++14. Default: $(value2switch $SRS_CXX14) --ffmpeg-fit=on|off Whether enable the FFmpeg fit(source code). Default: $(value2switch $SRS_FFMPEG_FIT) @@ -356,6 +358,7 @@ function parse_user_option() { --ffmpeg-opus) SRS_FFMPEG_OPUS=$(switch2value $value) ;; --h265) SRS_H265=$(switch2value $value) ;; --gb28181) SRS_GB28181=$(switch2value $value) ;; + --sctp) SRS_SCTP=$(switch2value $value) ;; --cxx11) SRS_CXX11=$(switch2value $value) ;; --cxx14) SRS_CXX14=$(switch2value $value) ;; @@ -631,6 +634,7 @@ function regenerate_options() { 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)" + SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --sctp=$(value2switch $SRS_SCTP)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --simulator=$(value2switch $SRS_SIMULATOR)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cxx11=$(value2switch $SRS_CXX11)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cxx14=$(value2switch $SRS_CXX14)" diff --git a/trunk/research/console/en_index.html b/trunk/research/console/en_index.html index e8974c1334..e01ff9867b 100644 --- a/trunk/research/console/en_index.html +++ b/trunk/research/console/en_index.html @@ -2,7 +2,7 @@ - SRS控制台 + SRS Console + + + + + + + + + +
+
+ URL: + + +
+ +
+ +
+ SND: + + +
+ + +
+ RCV: + +
+
+ + +
+ + + + diff --git a/trunk/research/players/rtc_player.html b/trunk/research/players/rtc_player.html index 8941338a5c..6074e337b0 100644 --- a/trunk/research/players/rtc_player.html +++ b/trunk/research/players/rtc_player.html @@ -28,6 +28,7 @@
  • RTC推流
  • WHIP
  • WHEP
  • +
  • RTC数据
  • iOS/Andriod
  • diff --git a/trunk/research/players/rtc_publisher.html b/trunk/research/players/rtc_publisher.html index f78fb84a33..0773966e85 100644 --- a/trunk/research/players/rtc_publisher.html +++ b/trunk/research/players/rtc_publisher.html @@ -28,6 +28,7 @@
  • RTC推流
  • WHIP
  • WHEP
  • +
  • RTC数据
  • iOS/Andriod
  • diff --git a/trunk/research/players/srs_gb28181.html b/trunk/research/players/srs_gb28181.html index 14025650a0..ad6109b807 100644 --- a/trunk/research/players/srs_gb28181.html +++ b/trunk/research/players/srs_gb28181.html @@ -38,6 +38,7 @@
  • SRS播放器
  • RTC播放器
  • RTC推流
  • +
  • RTC数据
  • iOS/Andriod
  • diff --git a/trunk/research/players/srs_player.html b/trunk/research/players/srs_player.html index 7424bf6e54..2bb5e3e044 100755 --- a/trunk/research/players/srs_player.html +++ b/trunk/research/players/srs_player.html @@ -23,6 +23,7 @@
  • RTC推流
  • WHIP
  • WHEP
  • +
  • RTC数据
  • iOS/Andriod