From 6dc8d9dd6fd2fcbadc5060a658a59b55277c3398 Mon Sep 17 00:00:00 2001 From: winlin Date: Thu, 20 May 2021 20:07:13 +0800 Subject: [PATCH] SquashSRS4: Remove srs-librtmp --- .circleci/config.yml | 35 +++++--- AUTHORS.txt | 2 +- README.md | 1 + trunk/auto/auto_headers.sh | 14 ---- trunk/auto/depends.sh | 24 ++---- trunk/auto/options.sh | 105 +++++++++++------------- trunk/src/app/srs_app_gb28181_stack.cpp | 4 - trunk/src/app/srs_app_gb28181_stack.hpp | 4 - trunk/src/app/srs_app_hourglass.cpp | 2 + trunk/src/app/srs_app_hybrid.cpp | 2 + trunk/src/app/srs_app_rtc_conn.cpp | 5 +- trunk/src/app/srs_app_rtmp_conn.cpp | 10 ++- trunk/src/app/srs_app_threads.cpp | 51 ++++++++---- trunk/src/core/srs_core.hpp | 11 +-- trunk/src/core/srs_core_version4.hpp | 2 +- trunk/src/kernel/srs_kernel_aac.cpp | 4 - trunk/src/kernel/srs_kernel_aac.hpp | 4 - trunk/src/kernel/srs_kernel_mp3.cpp | 4 - trunk/src/kernel/srs_kernel_mp3.hpp | 4 - trunk/src/kernel/srs_kernel_rtc_rtp.cpp | 10 +-- trunk/src/kernel/srs_kernel_ts.cpp | 4 - trunk/src/kernel/srs_kernel_ts.hpp | 4 - trunk/src/protocol/srs_http_stack.cpp | 5 -- trunk/src/protocol/srs_http_stack.hpp | 5 -- trunk/src/protocol/srs_rtsp_stack.cpp | 4 - trunk/src/protocol/srs_rtsp_stack.hpp | 4 - 26 files changed, 137 insertions(+), 187 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 3438cfba3..59be9a326 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -6,15 +6,23 @@ jobs: steps: - checkout - run: | - echo "Build and run SRS baseline" && + echo "Build SRS baseline" && cd trunk && ./configure && make + build-c7-nortc: + docker: + - image: ossrs/srs:dev + steps: + - checkout + - run: | + echo "Build SRS without RTC" && + cd trunk && ./configure --rtc=off && make build-c7-noasm: docker: - image: ossrs/srs:dev steps: - checkout - run: | - echo "Build and run SRS without NASM or SRTP-NASM" && + echo "Build SRS without NASM or SRTP-NASM" && cd trunk && ./configure --nasm=off --srtp-nasm=off && make build-c7-gb28181: docker: @@ -22,7 +30,7 @@ jobs: steps: - checkout - run: | - echo "Build and run SRS with GB28181" && + echo "Build SRS with GB28181" && cd trunk && ./configure --gb28181=on && make build-c7-srt: docker: @@ -30,7 +38,7 @@ jobs: steps: - checkout - run: | - echo "Build and run SRS with SRT" && + echo "Build SRS with SRT" && cd trunk && ./configure --srt=on && make build-c8-baseline: docker: @@ -38,7 +46,7 @@ jobs: steps: - checkout - run: | - echo "Build and run SRS for CentOS8" && + echo "Build SRS for CentOS8" && cd trunk && ./configure && make build-c8-srt: docker: @@ -46,7 +54,7 @@ jobs: steps: - checkout - run: | - echo "Build and run SRS with SRT for CentOS8" && + echo "Build SRS with SRT for CentOS8" && cd trunk && ./configure --srt=on && make build-u16-baseline: docker: @@ -54,7 +62,7 @@ jobs: steps: - checkout - run: | - echo "Build and run SRS for Ubuntu16" && + echo "Build SRS for Ubuntu16" && cd trunk && ./configure && make build-u16-srt: docker: @@ -62,7 +70,7 @@ jobs: steps: - checkout - run: | - echo "Build and run SRS with SRT for Ubuntu16" && + echo "Build SRS with SRT for Ubuntu16" && cd trunk && ./configure --srt=on && make build-u18-baseline: docker: @@ -70,7 +78,7 @@ jobs: steps: - checkout - run: | - echo "Build and run SRS for Ubuntu18" && + echo "Build SRS for Ubuntu18" && cd trunk && ./configure && make build-u18-srt: docker: @@ -78,7 +86,7 @@ jobs: steps: - checkout - run: | - echo "Build and run SRS with SRT for Ubuntu18" && + echo "Build SRS with SRT for Ubuntu18" && cd trunk && ./configure --srt=on && make build-u20-baseline: docker: @@ -86,7 +94,7 @@ jobs: steps: - checkout - run: | - echo "Build and run SRS for Ubuntu20" && + echo "Build SRS for Ubuntu20" && cd trunk && ./configure && make build-u20-srt: docker: @@ -94,7 +102,7 @@ jobs: steps: - checkout - run: | - echo "Build and run SRS with SRT for Ubuntu20" && + echo "Build SRS with SRT for Ubuntu20" && cd trunk && ./configure --srt=on && make run-utest: docker: @@ -121,7 +129,7 @@ jobs: steps: - checkout - run: | - echo "Build and run SRS C++98(ANSI), no FFmpeg-fit" && + echo "Build SRS C++98(ANSI), no FFmpeg-fit" && cd trunk && ./configure --cxx11=off --cxx14=off --ffmpeg-fit=off && make workflows: version: 2 @@ -130,6 +138,7 @@ workflows: - build-c7-baseline - run-utest - run-regression-test + - build-c7-nortc - build-c7-noasm - build-c7-gb28181 - build-c7-srt diff --git a/AUTHORS.txt b/AUTHORS.txt index f16b2c853..099d3d620 100644 --- a/AUTHORS.txt +++ b/AUTHORS.txt @@ -73,7 +73,7 @@ CONTRIBUTORS ordered by first contribution. * liulichuan * yapingcat * chenchengbin -* chenhaibo +* chenhaibo * jasongwq * xialixin * yinjiaoyuan diff --git a/README.md b/README.md index 0fb9fde84..3b96d327f 100755 --- a/README.md +++ b/README.md @@ -183,6 +183,7 @@ The ports used by SRS: ## V4 changes +* v4.0, 2021-05-20, Fix build fail when disable RTC by --rtc=off. 4.0.118 * v4.0, 2021-05-19, Fix [#2362][bug #2362]: Allow WebRTC to play before publishing, for GB28181 as such. 4.0.117 * v4.0, 2021-05-18, Fix [#2355][bug #2355]: GB28181: Fix play by RTC bug. 4.0.116 * v4.0, 2021-05-15, SRT: Build SRT from source by SRS. 4.0.115 diff --git a/trunk/auto/auto_headers.sh b/trunk/auto/auto_headers.sh index 1704b182e..fa6a55e58 100755 --- a/trunk/auto/auto_headers.sh +++ b/trunk/auto/auto_headers.sh @@ -39,20 +39,6 @@ function srs_undefine_macro() echo "#define ${macro}_BOOL false" >> $file } -# export the preset. -if [ $SRS_X86_X64 = YES ]; then - srs_define_macro "SRS_X86_X64" $SRS_AUTO_HEADERS_H -fi -if [ $SRS_PI = YES ]; then - srs_define_macro "SRS_PI" $SRS_AUTO_HEADERS_H -fi -if [ $SRS_CUBIE = YES ]; then - srs_define_macro "SRS_CUBIE" $SRS_AUTO_HEADERS_H -fi -echo "#undef SRS_EXPORT_LIBRTMP" >> $SRS_AUTO_HEADERS_H - -echo "" >> $SRS_AUTO_HEADERS_H - ##################################################################################### # generate auto headers file, depends on the finished of options.sh ##################################################################################### diff --git a/trunk/auto/depends.sh b/trunk/auto/depends.sh index deeb052ec..f32464bdf 100755 --- a/trunk/auto/depends.sh +++ b/trunk/auto/depends.sh @@ -33,16 +33,12 @@ echo "Required tools are ok." OS_IS_UBUNTU=NO function Ubuntu_prepare() { - if [ $SRS_CUBIE = YES ]; then - echo "For cubieboard, please use ubuntu prepare." - else - uname -v|grep Ubuntu >/dev/null 2>&1 - ret=$?; if [[ 0 -ne $ret ]]; then - # for debian, we think it's ubuntu also. - # for example, the wheezy/sid which is debian armv7 linux, can not identified by uname -v. - if [[ ! -f /etc/debian_version ]]; then - return 0; - fi + uname -v|grep Ubuntu >/dev/null 2>&1 + ret=$?; if [[ 0 -ne $ret ]]; then + # for debian, we think it's ubuntu also. + # for example, the wheezy/sid which is debian armv7 linux, can not identified by uname -v. + if [[ ! -f /etc/debian_version ]]; then + return 0; fi fi @@ -380,11 +376,9 @@ function _srs_link_file() # directly build on arm/mips, for example, pi or cubie, # export srs-librtmp # others is invalid. -if [[ $OS_IS_UBUNTU = NO && $OS_IS_CENTOS = NO && $OS_IS_OSX = NO ]]; then - if [[ $SRS_PI = NO && $SRS_CUBIE = NO && $SRS_CROSS_BUILD = NO ]]; then - echo "Your OS `uname -s` is not supported." - exit 1 - fi +if [[ $OS_IS_UBUNTU = NO && $OS_IS_CENTOS = NO && $OS_IS_OSX = NO && $SRS_CROSS_BUILD = NO ]]; then + echo "Your OS `uname -s` is not supported." + exit 1 fi ##################################################################################### diff --git a/trunk/auto/options.sh b/trunk/auto/options.sh index 55631a5fc..378f71819 100755 --- a/trunk/auto/options.sh +++ b/trunk/auto/options.sh @@ -17,7 +17,7 @@ help=no # feature options SRS_HDS=NO SRS_SRT=NO -SRS_RTC=YES +SRS_RTC=RESERVED SRS_GB28181=NO SRS_CXX11=YES SRS_CXX14=NO @@ -90,33 +90,15 @@ SRS_CLEAN=YES SRS_SIMULATOR=NO # ################################################################ -# presets -# for x86/x64 pc/servers +# Preset, for x86_64 servers SRS_X86_X64=NO -# for osx system +# Preset, for osx/macOS PC. SRS_OSX=NO -# dev, open all features for dev, no gperf/prof/arm. -SRS_DEV=NO -# dev, open main server feature for dev, no utest/research/librtmp -SRS_FAST_DEV=NO -# demo, for the demo of srs, @see: https://github.com/ossrs/srs/wiki/v1_CN_SampleDemo -SRS_DEMO=NO -# raspberry-pi, open hls/ssl/static -SRS_PI=NO -# cubieboard, donot open ffmpeg/nginx. -SRS_CUBIE=NO -# the most fast compile, nothing, only support vp6 RTMP. -SRS_FAST=NO -# only support RTMP with ssl. -SRS_PURE_RTMP=NO -# the most fast compile, nothing, only support vp6 RTMP. -SRS_DISABLE_ALL=NO -# all features is on -SRS_ENABLE_ALL=NO +# Preset, for cross build, for example, on Ubuntu. +SRS_CROSS_BUILD=NO # ##################################################################################### -# Toolchain crossbuild for ARM or MIPS. -SRS_CROSS_BUILD=NO +# Toolchain cross-build for ARM or MIPS. SRS_TOOL_CC=gcc SRS_TOOL_CXX=g++ SRS_TOOL_AR=ar @@ -139,7 +121,7 @@ function show_help() { Presets: --x86-64, --x86-x64 For x86/x64 cpu, common pc and servers. Default: $(value2switch $SRS_X86_X64) - --arm Enable crossbuild for ARM, should also set bellow toolchain options. Default: $(value2switch $SRS_CROSS_BUILD) + --arm Enable cross-build for ARM, please set bellow Toolchain also. Default: $(value2switch $SRS_CROSS_BUILD) --osx Enable build for OSX/Darwin AppleOS. Default: $(value2switch $SRS_OSX) Features: @@ -179,11 +161,11 @@ Performance: @see https://blog.csdn.net/win_lin/article/details/5 Toolchain options: @see https://github.com/ossrs/srs/issues/1547#issuecomment-576078411 --static=on|off Whether add '-static' to link options. Default: $(value2switch $SRS_STATIC) - --cc= Use c compiler CC. Default: $SRS_TOOL_CC - --cxx= Use c++ compiler CXX. Default: $SRS_TOOL_CXX - --ar= Use archive tool AR. Default: $SRS_TOOL_CXX - --ld= Use linker tool LD. Default: $SRS_TOOL_CXX - --randlib= Use randlib tool RANDLIB. Default: $SRS_TOOL_CXX + --cc= Toolchain: Use c compiler CC. Default: $SRS_TOOL_CC + --cxx= Toolchain: Use c++ compiler CXX. Default: $SRS_TOOL_CXX + --ar= Toolchain: Use archive tool AR. Default: $SRS_TOOL_CXX + --ld= Toolchain: Use linker tool LD. Default: $SRS_TOOL_CXX + --randlib= Toolchain: Use randlib tool RANDLIB. Default: $SRS_TOOL_CXX --extra-flags= Set EFLAGS as CFLAGS and CXXFLAGS. Also passed to ST as EXTRA_CFLAGS. Experts: @@ -357,35 +339,41 @@ function parse_user_option() { --debug) if [[ $value == off ]]; then SRS_DEBUG=NO; else SRS_DEBUG=YES; fi ;; --debug-stats) if [[ $value == off ]]; then SRS_DEBUG_STATS=NO; else SRS_DEBUG_STATS=YES; fi ;; - # Deprecated, might be removed in future. + # Alias for --arm, cross build. --arm) SRS_CROSS_BUILD=YES ;; --mips) SRS_CROSS_BUILD=YES ;; - --pi) SRS_PI=YES ;; - --cubie) SRS_CUBIE=YES ;; - --dev) SRS_DEV=YES ;; - --fast-dev) SRS_FAST_DEV=YES ;; - --demo) SRS_DEMO=YES ;; - --fast) SRS_FAST=YES ;; - --disable-all) SRS_DISABLE_ALL=YES ;; - --pure-rtmp) SRS_PURE_RTMP=YES ;; - --full) SRS_ENABLE_ALL=YES ;; + --with-arm-ubuntu12) SRS_CROSS_BUILD=YES ;; + --without-arm-ubuntu12) SRS_CROSS_BUILD=NO ;; + --arm-ubuntu12) if [[ $value == off ]]; then SRS_CROSS_BUILD=NO; else SRS_CROSS_BUILD=YES; fi ;; + --with-mips-ubuntu12) SRS_CROSS_BUILD=YES ;; + --without-mips-ubuntu12) SRS_CROSS_BUILD=NO ;; + --mips-ubuntu12) if [[ $value == off ]]; then SRS_CROSS_BUILD=NO; else SRS_CROSS_BUILD=YES; fi ;; + + # Removed features. --export-librtmp-project) SRS_EXPORT_LIBRTMP_PROJECT=${value} ;; --export-librtmp-single) SRS_EXPORT_LIBRTMP_SINGLE=${value} ;; + --with-librtmp) SRS_LIBRTMP=YES ;; + --without-librtmp) SRS_LIBRTMP=NO ;; + --librtmp) if [[ $value == off ]]; then SRS_LIBRTMP=NO; else SRS_LIBRTMP=YES; fi ;; + + # Deprecated, might be removed in future. --with-nginx) SRS_NGINX=YES ;; --without-nginx) SRS_NGINX=NO ;; --nginx) if [[ $value == off ]]; then SRS_NGINX=NO; else SRS_NGINX=YES; fi ;; --with-ffmpeg) SRS_FFMPEG_TOOL=YES ;; --without-ffmpeg) SRS_FFMPEG_TOOL=NO ;; --ffmpeg-tool) if [[ $value == off ]]; then SRS_FFMPEG_TOOL=NO; else SRS_FFMPEG_TOOL=YES; fi ;; - --with-librtmp) SRS_LIBRTMP=YES ;; - --without-librtmp) SRS_LIBRTMP=NO ;; - --librtmp) if [[ $value == off ]]; then SRS_LIBRTMP=NO; else SRS_LIBRTMP=YES; fi ;; - --with-arm-ubuntu12) SRS_CROSS_BUILD=YES ;; - --without-arm-ubuntu12) SRS_CROSS_BUILD=NO ;; - --arm-ubuntu12) if [[ $value == off ]]; then SRS_CROSS_BUILD=NO; else SRS_CROSS_BUILD=YES; fi ;; - --with-mips-ubuntu12) SRS_CROSS_BUILD=YES ;; - --without-mips-ubuntu12) SRS_CROSS_BUILD=NO ;; - --mips-ubuntu12) if [[ $value == off ]]; then SRS_CROSS_BUILD=NO; else SRS_CROSS_BUILD=YES; fi ;; + + # Ignore the options. + --demo) echo "Ignore $option" ;; + --dev) echo "Ignore $option" ;; + --fast-dev) echo "Ignore $option" ;; + --pi) echo "Ignore $option" ;; + --cubie) echo "Ignore $option" ;; + --fast) echo "Ignore $option" ;; + --pure-rtmp) echo "Ignore $option" ;; + --disable-all) echo "Ignore $option" ;; + --full) echo "Ignore $option" ;; *) echo "$0: error: invalid option \"$option\"" @@ -447,6 +435,11 @@ function apply_detail_options() { SRS_X86_X64=YES; opt="--x86-x64 $opt"; fi + # Setup the default values if not set. + if [[ $SRS_RTC == RESERVED ]]; then + SRS_RTC=YES; if [[ $SRS_CROSS_BUILD == YES ]]; then SRS_RTC=NO; fi + fi + # The SRT code in SRS requires c++11, although we build libsrt without c++11. # TODO: FIXME: Remove c++11 code in SRT of SRS. if [[ $SRS_SRT == YES ]]; then @@ -485,19 +478,16 @@ function apply_detail_options() { # if specified export single file, export project first. if [ $SRS_EXPORT_LIBRTMP_SINGLE != NO ]; then - echo "Warning: Ingore --export-librtmp-single" - SRS_EXPORT_LIBRTMP_SINGLE=NO + echo "Error: srs-librtmp is removed, please read https://github.com/ossrs/srs-librtmp/issues/32"; exit 1 fi # disable almost all features for export srs-librtmp. if [ $SRS_EXPORT_LIBRTMP_PROJECT != NO ]; then - echo "Warning: Ingore --export-librtmp-project" - SRS_EXPORT_LIBRTMP_PROJECT=NO + echo "Error: srs-librtmp is removed, please read https://github.com/ossrs/srs-librtmp/issues/32"; exit 1 fi if [[ $SRS_LIBRTMP != NO ]]; then - echo "Warning: Ingore --librtmp" - SRS_LIBRTMP=NO + echo "Error: srs-librtmp is removed, please read https://github.com/ossrs/srs-librtmp/issues/32"; exit 1 fi if [[ $SRS_RESEARCH != NO ]]; then @@ -581,12 +571,11 @@ regenerate_options ##################################################################################### function check_option_conflicts() { if [[ $SRS_TOOL_CC == '' || $SRS_TOOL_CXX == '' || $SRS_TOOL_AR == '' || $SRS_TOOL_LD == '' || $SRS_TOOL_RANDLIB == '' ]]; then - echo "No crossbuild tools, cc: $SRS_TOOL_CC, cxx: $SRS_TOOL_CXX, ar: $SRS_TOOL_AR, ld: $SRS_TOOL_LD, randlib: $SRS_TOOL_RANDLIB"; exit -1 + echo "Error: No build toolchain, cc: $SRS_TOOL_CC, cxx: $SRS_TOOL_CXX, ar: $SRS_TOOL_AR, ld: $SRS_TOOL_LD, randlib: $SRS_TOOL_RANDLIB"; exit -1 fi if [[ $SRS_CROSS_BUILD == YES && ($SRS_TOOL_CC == 'gcc' || $SRS_TOOL_CXX == 'g++' || $SRS_TOOL_AR == 'ar') ]]; then - echo "Warning: For crossbuild, must not use default toolchain, cc: $SRS_TOOL_CC, cxx: $SRS_TOOL_CXX, ar: $SRS_TOOL_AR" - SRS_CROSS_BUILD=NO + echo "Error: For cross build, should setup the toolchain(./configure -h|grep -i toolchain), cc: $SRS_TOOL_CC, cxx: $SRS_TOOL_CXX, ar: $SRS_TOOL_AR"; exit 1 fi if [[ $SRS_NGINX == YES ]]; then diff --git a/trunk/src/app/srs_app_gb28181_stack.cpp b/trunk/src/app/srs_app_gb28181_stack.cpp index 198a270c6..c5bcfda0c 100644 --- a/trunk/src/app/srs_app_gb28181_stack.cpp +++ b/trunk/src/app/srs_app_gb28181_stack.cpp @@ -23,8 +23,6 @@ #include -#if !defined(SRS_EXPORT_LIBRTMP) - #include #include #include @@ -1457,5 +1455,3 @@ void SrsSipStack::req_ptz(std::stringstream& ss, SrsSipRequest *req, uint8_t cmd } -#endif - diff --git a/trunk/src/app/srs_app_gb28181_stack.hpp b/trunk/src/app/srs_app_gb28181_stack.hpp index 67651e740..87e7e1509 100644 --- a/trunk/src/app/srs_app_gb28181_stack.hpp +++ b/trunk/src/app/srs_app_gb28181_stack.hpp @@ -26,8 +26,6 @@ #include -#if !defined(SRS_EXPORT_LIBRTMP) - #include #include #include @@ -185,5 +183,3 @@ public: #endif -#endif - diff --git a/trunk/src/app/srs_app_hourglass.cpp b/trunk/src/app/srs_app_hourglass.cpp index 191a76a90..7af313cde 100644 --- a/trunk/src/app/srs_app_hourglass.cpp +++ b/trunk/src/app/srs_app_hourglass.cpp @@ -33,6 +33,8 @@ using namespace std; #include SrsPps* _srs_pps_timer = NULL; +SrsPps* _srs_pps_conn = NULL; +SrsPps* _srs_pps_pub = NULL; extern SrsPps* _srs_pps_clock_15ms; extern SrsPps* _srs_pps_clock_20ms; diff --git a/trunk/src/app/srs_app_hybrid.cpp b/trunk/src/app/srs_app_hybrid.cpp index 764644f8a..fd183f461 100644 --- a/trunk/src/app/srs_app_hybrid.cpp +++ b/trunk/src/app/srs_app_hybrid.cpp @@ -374,6 +374,7 @@ srs_error_t SrsHybridServer::on_timer(srs_utime_t interval) #endif string objs_desc; +#ifdef SRS_RTC _srs_pps_objs_rtps->update(); _srs_pps_objs_rraw->update(); _srs_pps_objs_rfua->update(); _srs_pps_objs_rbuf->update(); _srs_pps_objs_msgs->update(); _srs_pps_objs_rothers->update(); if (_srs_pps_objs_rtps->r10s() || _srs_pps_objs_rraw->r10s() || _srs_pps_objs_rfua->r10s() || _srs_pps_objs_rbuf->r10s() || _srs_pps_objs_msgs->r10s() || _srs_pps_objs_rothers->r10s()) { snprintf(buf, sizeof(buf), ", objs=(pkt:%d,raw:%d,fua:%d,msg:%d,oth:%d,buf:%d)", @@ -381,6 +382,7 @@ srs_error_t SrsHybridServer::on_timer(srs_utime_t interval) _srs_pps_objs_msgs->r10s(), _srs_pps_objs_rothers->r10s(), _srs_pps_objs_rbuf->r10s()); objs_desc = buf; } +#endif srs_trace("Hybrid cpu=%.2f%%,%dMB%s%s%s%s%s%s%s%s%s%s%s", u->percent * 100, memory, diff --git a/trunk/src/app/srs_app_rtc_conn.cpp b/trunk/src/app/srs_app_rtc_conn.cpp index fe6fcdb7f..a2cac352c 100644 --- a/trunk/src/app/srs_app_rtc_conn.cpp +++ b/trunk/src/app/srs_app_rtc_conn.cpp @@ -68,8 +68,6 @@ SrsPps* _srs_pps_srtps = NULL; SrsPps* _srs_pps_pli = NULL; SrsPps* _srs_pps_twcc = NULL; SrsPps* _srs_pps_rr = NULL; -SrsPps* _srs_pps_pub = NULL; -SrsPps* _srs_pps_conn = NULL; extern SrsPps* _srs_pps_snack; extern SrsPps* _srs_pps_snack2; @@ -79,6 +77,9 @@ extern SrsPps* _srs_pps_snack4; extern SrsPps* _srs_pps_rnack; extern SrsPps* _srs_pps_rnack2; +extern SrsPps* _srs_pps_pub; +extern SrsPps* _srs_pps_conn; + ISrsRtcTransport::ISrsRtcTransport() { } diff --git a/trunk/src/app/srs_app_rtmp_conn.cpp b/trunk/src/app/srs_app_rtmp_conn.cpp index 1f1b256cb..738a0e4a2 100644 --- a/trunk/src/app/srs_app_rtmp_conn.cpp +++ b/trunk/src/app/srs_app_rtmp_conn.cpp @@ -961,12 +961,14 @@ srs_error_t SrsRtmpConn::acquire_publish(SrsLiveSource* source) SrsRequest* req = info->req; - // @see https://github.com/ossrs/srs/issues/2364 + // @see https://github.com/ossrs/srs/issues/2364 // Check whether GB28181 stream is busy. #if defined(SRS_GB28181) - SrsGb28181RtmpMuxer* gb28181 = _srs_gb28181->fetch_rtmpmuxer(req->stream); - if (gb28181 != NULL) { - return srs_error_new(ERROR_SYSTEM_STREAM_BUSY, "gb28181 stream %s busy", req->get_stream_url().c_str()); + if (_srs_gb28181 != NULL) { + SrsGb28181RtmpMuxer* gb28181 = _srs_gb28181->fetch_rtmpmuxer(req->stream); + if (gb28181 != NULL) { + return srs_error_new(ERROR_SYSTEM_STREAM_BUSY, "gb28181 stream %s busy", req->get_stream_url().c_str()); + } } #endif diff --git a/trunk/src/app/srs_app_threads.cpp b/trunk/src/app/srs_app_threads.cpp index 8f4b52715..dab5df616 100644 --- a/trunk/src/app/srs_app_threads.cpp +++ b/trunk/src/app/srs_app_threads.cpp @@ -31,9 +31,12 @@ #include #include #include +#include + +#ifdef SRS_RTC #include #include -#include +#endif #include using namespace std; @@ -43,11 +46,14 @@ extern ISrsContext* _srs_context; extern SrsConfig* _srs_config; extern SrsStageManager* _srs_stages; + +#ifdef SRS_RTC extern SrsRtcBlackhole* _srs_blackhole; extern SrsResourceManager* _srs_rtc_manager; extern SrsResourceManager* _srs_rtc_manager; extern SrsDtlsCertificate* _srs_rtc_dtls_certificate; +#endif #include @@ -254,12 +260,24 @@ srs_error_t SrsCircuitBreaker::on_timer(srs_utime_t interval) // The hybrid thread cpu and memory. float thread_percent = stat->percent * 100; - if (enabled_ && (hybrid_high_water_level() || hybrid_critical_water_level() || _srs_pps_snack2->r10s())) { - srs_trace("CircuitBreaker: cpu=%.2f%%,%dMB, break=%d,%d,%d, cond=%.2f%%, snk=%d,%d,%d", + static char buf[128]; + + string snk_desc; +#ifdef SRS_RTC + if (_srs_pps_snack2->r10s()) { + snprintf(buf, sizeof(buf), ", snk=%d,%d,%d", + _srs_pps_snack2->r10s(), _srs_pps_snack3->r10s(), _srs_pps_snack4->r10s() // NACK packet,seqs sent. + ); + snk_desc = buf; + } +#endif + + if (enabled_ && (hybrid_high_water_level() || hybrid_critical_water_level())) { + srs_trace("CircuitBreaker: cpu=%.2f%%,%dMB, break=%d,%d,%d, cond=%.2f%%%s", u->percent * 100, memory, hybrid_high_water_level(), hybrid_critical_water_level(), hybrid_dying_water_level(), // Whether Circuit-Break is enable. thread_percent, // The conditions to enable Circuit-Breaker. - _srs_pps_snack2->r10s(), _srs_pps_snack3->r10s(), _srs_pps_snack4->r10s() // NACK packet,seqs sent. + snk_desc.c_str() ); } @@ -291,15 +309,17 @@ srs_error_t srs_thread_initialize() // The global objects which depends on ST. _srs_hybrid = new SrsHybridServer(); - _srs_rtc_sources = new SrsRtcSourceManager(); _srs_sources = new SrsLiveSourceManager(); _srs_stages = new SrsStageManager(); - _srs_blackhole = new SrsRtcBlackhole(); - _srs_rtc_manager = new SrsResourceManager("RTC", true); _srs_circuit_breaker = new SrsCircuitBreaker(); +#ifdef SRS_RTC + _srs_rtc_sources = new SrsRtcSourceManager(); + _srs_blackhole = new SrsRtcBlackhole(); + _srs_rtc_manager = new SrsResourceManager("RTC", true); _srs_rtc_dtls_certificate = new SrsDtlsCertificate(); +#endif // Initialize global pps, which depends on _srs_clock _srs_pps_ids = new SrsPps(); @@ -308,7 +328,10 @@ srs_error_t srs_thread_initialize() _srs_pps_dispose = new SrsPps(); _srs_pps_timer = new SrsPps(); + _srs_pps_conn = new SrsPps(); + _srs_pps_pub = new SrsPps(); +#ifdef SRS_RTC _srs_pps_snack = new SrsPps(); _srs_pps_snack2 = new SrsPps(); _srs_pps_snack3 = new SrsPps(); @@ -320,6 +343,7 @@ srs_error_t srs_thread_initialize() _srs_pps_rnack2 = new SrsPps(); _srs_pps_rhnack = new SrsPps(); _srs_pps_rmnack = new SrsPps(); +#endif #if defined(SRS_DEBUG) && defined(SRS_DEBUG_STATS) _srs_pps_recvfrom = new SrsPps(); @@ -377,30 +401,29 @@ srs_error_t srs_thread_initialize() _srs_pps_fast_addrs = new SrsPps(); _srs_pps_spkts = new SrsPps(); + _srs_pps_objs_msgs = new SrsPps(); +#ifdef SRS_RTC _srs_pps_sstuns = new SrsPps(); _srs_pps_srtcps = new SrsPps(); _srs_pps_srtps = new SrsPps(); - _srs_pps_pli = new SrsPps(); - _srs_pps_twcc = new SrsPps(); - _srs_pps_rr = new SrsPps(); - _srs_pps_pub = new SrsPps(); - _srs_pps_conn = new SrsPps(); - _srs_pps_rstuns = new SrsPps(); _srs_pps_rrtps = new SrsPps(); _srs_pps_rrtcps = new SrsPps(); _srs_pps_aloss2 = new SrsPps(); - _srs_pps_objs_msgs = new SrsPps(); + _srs_pps_pli = new SrsPps(); + _srs_pps_twcc = new SrsPps(); + _srs_pps_rr = new SrsPps(); _srs_pps_objs_rtps = new SrsPps(); _srs_pps_objs_rraw = new SrsPps(); _srs_pps_objs_rfua = new SrsPps(); _srs_pps_objs_rbuf = new SrsPps(); _srs_pps_objs_rothers = new SrsPps(); +#endif return err; } diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index f542a1a3a..0c0b111bf 100644 --- a/trunk/src/core/srs_core.hpp +++ b/trunk/src/core/srs_core.hpp @@ -98,13 +98,10 @@ } \ (void)0 -// For librtmp, it is pure c++ and supports all OS. -#ifndef SRS_EXPORT_LIBRTMP - // Checking for st(state-threads), only support the following cpus: i386/amd64/x86_64/arm - // @reamrk To patch ST for arm, read https://github.com/ossrs/state-threads/issues/1 - #if !defined(__amd64__) && !defined(__x86_64__) && !defined(__i386__) && !defined(__arm__) && !defined(__aarch64__) - #error "only support i386/amd64/x86_64/arm cpu" - #endif +// Checking for st(state-threads), only support the following cpus: i386/amd64/x86_64/arm +// @reamrk To patch ST for arm, read https://github.com/ossrs/state-threads/issues/1 +#if !defined(__amd64__) && !defined(__x86_64__) && !defined(__i386__) && !defined(__arm__) && !defined(__aarch64__) + #error "only support i386/amd64/x86_64/arm cpu" #endif // Error predefined for all modules. diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index 9cac0d463..a789747f8 100644 --- a/trunk/src/core/srs_core_version4.hpp +++ b/trunk/src/core/srs_core_version4.hpp @@ -26,6 +26,6 @@ #define VERSION_MAJOR 4 #define VERSION_MINOR 0 -#define VERSION_REVISION 117 +#define VERSION_REVISION 118 #endif diff --git a/trunk/src/kernel/srs_kernel_aac.cpp b/trunk/src/kernel/srs_kernel_aac.cpp index 89d28a2b1..47749c5f0 100644 --- a/trunk/src/kernel/srs_kernel_aac.cpp +++ b/trunk/src/kernel/srs_kernel_aac.cpp @@ -23,8 +23,6 @@ #include -#if !defined(SRS_EXPORT_LIBRTMP) - // for srs-librtmp, @see https://github.com/ossrs/srs/issues/213 #ifndef _WIN32 #include @@ -202,5 +200,3 @@ srs_error_t SrsAacTransmuxer::write_audio(int64_t timestamp, char* data, int siz return err; } -#endif - diff --git a/trunk/src/kernel/srs_kernel_aac.hpp b/trunk/src/kernel/srs_kernel_aac.hpp index 5136b6210..14281827f 100644 --- a/trunk/src/kernel/srs_kernel_aac.hpp +++ b/trunk/src/kernel/srs_kernel_aac.hpp @@ -26,8 +26,6 @@ #include -#if !defined(SRS_EXPORT_LIBRTMP) - #include #include @@ -61,5 +59,3 @@ public: #endif -#endif - diff --git a/trunk/src/kernel/srs_kernel_mp3.cpp b/trunk/src/kernel/srs_kernel_mp3.cpp index 6b7d9229d..df5c91788 100644 --- a/trunk/src/kernel/srs_kernel_mp3.cpp +++ b/trunk/src/kernel/srs_kernel_mp3.cpp @@ -23,8 +23,6 @@ #include -#if !defined(SRS_EXPORT_LIBRTMP) - // for srs-librtmp, @see https://github.com/ossrs/srs/issues/213 #ifndef _WIN32 #include @@ -126,5 +124,3 @@ srs_error_t SrsMp3Transmuxer::write_audio(int64_t timestamp, char* data, int siz return err; } -#endif - diff --git a/trunk/src/kernel/srs_kernel_mp3.hpp b/trunk/src/kernel/srs_kernel_mp3.hpp index f2e9c6055..581fe38dc 100644 --- a/trunk/src/kernel/srs_kernel_mp3.hpp +++ b/trunk/src/kernel/srs_kernel_mp3.hpp @@ -26,8 +26,6 @@ #include -#if !defined(SRS_EXPORT_LIBRTMP) - #include class SrsBuffer; @@ -65,5 +63,3 @@ public: #endif -#endif - diff --git a/trunk/src/kernel/srs_kernel_rtc_rtp.cpp b/trunk/src/kernel/srs_kernel_rtc_rtp.cpp index c3dbc7b94..8fe2df058 100644 --- a/trunk/src/kernel/srs_kernel_rtc_rtp.cpp +++ b/trunk/src/kernel/srs_kernel_rtc_rtp.cpp @@ -823,9 +823,8 @@ char* SrsRtpPacket::wrap(char* data, int size) char* SrsRtpPacket::wrap(SrsSharedPtrMessage* msg) { - // Generally, the wrap(msg) is used for RTMP to RTC, which is not generated by RTC, - // so we do not recycle the msg. It's ok to directly free the msg, event the msg is - // allocated by object cache manager. + // Generally, the wrap(msg) is used for RTMP to RTC, where the msg + // is not generated by RTC. srs_freep(shared_buffer_); // Copy from the new message. @@ -840,11 +839,6 @@ SrsRtpPacket* SrsRtpPacket::copy() { SrsRtpPacket* cp = new SrsRtpPacket(); - // We got packet from cache, the payload and message MUST be NULL, - // because we had clear it in recycle. - //srs_assert(!cp->payload_); - //srs_assert(!cp->shared_buffer_); - cp->header = header; cp->payload_ = payload_? payload_->copy():NULL; cp->payload_type_ = payload_type_; diff --git a/trunk/src/kernel/srs_kernel_ts.cpp b/trunk/src/kernel/srs_kernel_ts.cpp index 8bce1e9c4..0db82e797 100644 --- a/trunk/src/kernel/srs_kernel_ts.cpp +++ b/trunk/src/kernel/srs_kernel_ts.cpp @@ -23,8 +23,6 @@ #include -#if !defined(SRS_EXPORT_LIBRTMP) - // for srs-librtmp, @see https://github.com/ossrs/srs/issues/213 #ifndef _WIN32 #include @@ -3174,5 +3172,3 @@ srs_error_t SrsTsTransmuxer::flush_video() return err; } -#endif - diff --git a/trunk/src/kernel/srs_kernel_ts.hpp b/trunk/src/kernel/srs_kernel_ts.hpp index 303a5262b..14a77e422 100644 --- a/trunk/src/kernel/srs_kernel_ts.hpp +++ b/trunk/src/kernel/srs_kernel_ts.hpp @@ -26,8 +26,6 @@ #include -#if !defined(SRS_EXPORT_LIBRTMP) - #include #include #include @@ -1350,5 +1348,3 @@ private: #endif -#endif - diff --git a/trunk/src/protocol/srs_http_stack.cpp b/trunk/src/protocol/srs_http_stack.cpp index 440a3de1f..acb196f70 100644 --- a/trunk/src/protocol/srs_http_stack.cpp +++ b/trunk/src/protocol/srs_http_stack.cpp @@ -23,8 +23,6 @@ #include -#if !defined(SRS_EXPORT_LIBRTMP) - #include #include #include @@ -1346,9 +1344,6 @@ srs_error_t SrsHttpUri::path_unescape(std::string s, std::string& value) return unescapse(s, value, encodePathSegment); } -// For #if !defined(SRS_EXPORT_LIBRTMP) -#endif - // LCOV_EXCL_START ///////////////////////////////////////////////////////////////////////////////////////// diff --git a/trunk/src/protocol/srs_http_stack.hpp b/trunk/src/protocol/srs_http_stack.hpp index 736b81800..99a867b7a 100644 --- a/trunk/src/protocol/srs_http_stack.hpp +++ b/trunk/src/protocol/srs_http_stack.hpp @@ -28,8 +28,6 @@ #include -#if !defined(SRS_EXPORT_LIBRTMP) - #include #include #include @@ -549,9 +547,6 @@ public: static srs_error_t path_unescape(std::string s, std::string& value); }; -// For #if !defined(SRS_EXPORT_LIBRTMP) -#endif - // For #ifndef SRS_PROTOCOL_HTTP_HPP #endif diff --git a/trunk/src/protocol/srs_rtsp_stack.cpp b/trunk/src/protocol/srs_rtsp_stack.cpp index 8755dcea9..618b2d456 100644 --- a/trunk/src/protocol/srs_rtsp_stack.cpp +++ b/trunk/src/protocol/srs_rtsp_stack.cpp @@ -23,8 +23,6 @@ #include -#if !defined(SRS_EXPORT_LIBRTMP) - #include #include using namespace std; @@ -1100,5 +1098,3 @@ srs_error_t SrsRtspStack::recv_token(std::string& token, SrsRtspTokenState& stat return err; } -#endif - diff --git a/trunk/src/protocol/srs_rtsp_stack.hpp b/trunk/src/protocol/srs_rtsp_stack.hpp index 0f8359f10..3b0da4538 100644 --- a/trunk/src/protocol/srs_rtsp_stack.hpp +++ b/trunk/src/protocol/srs_rtsp_stack.hpp @@ -26,8 +26,6 @@ #include -#if !defined(SRS_EXPORT_LIBRTMP) - #include #include @@ -578,5 +576,3 @@ private: #endif -#endif -