From 6ec97067de8584041b51347e2ef9da2287b53eef Mon Sep 17 00:00:00 2001 From: Winlin Date: Thu, 21 Aug 2025 10:03:38 -0600 Subject: [PATCH] AI: Remove cygwin64, always enable WebRTC, and enforce C++98 compatibility. v7.0.60 (#4447) This PR makes WebRTC a core feature of SRS and enforces C++98 compatibility by: 1. Always Enable WebRTC Support - Remove `--rtc=on|off` configuration option - WebRTC is now always enabled - Eliminate all `#ifdef SRS_RTC` conditional compilation blocks - Include WebRTC-related modules (RTC, SRTP, DTLS) in all builds - Update build scripts to always link WebRTC dependencies 2. Enforce C++98 Compatibility - Remove `--cxx11=on|off` and `--cxx14=on|off` configuration options - Force `SRS_CXX11=NO` and `SRS_CXX14=NO` in build system - Move these options to deprecated section with warnings - Ensure codebase maintains C++98 standard compatibility 3. Remove Windows/Cygwin Support - Remove all Windows and Cygwin64 conditional compilation blocks (#ifdef _WIN32, #ifdef CYGWIN64) - Delete Cygwin64 build configurations from build scripts ( auto/options.sh, auto/depends.sh, configure) - Remove Cygwin64 assembly files and State Threads platform support ( md_cygwin64.S) - Eliminate Windows-specific GitHub Actions workflows and CI/CD jobs - Remove NSIS packaging files and Windows installer generation - Delete Windows documentation and update feature lists to mark support as removed in v7.0 - Simplify OS detection to only support Unix-like systems (Linux, macOS) 4. Code Cleanup - Remove conditional WebRTC code blocks throughout the codebase - Simplify build configuration by removing WebRTC-related conditionals - Update constructor delegation patterns to be C++98 compatible - Fix vector initialization to use C++98 syntax - Eliminate Windows-specific implementations for file operations, time handling, and networking - Unified platform handling with consistent POSIX API usage --------- Co-authored-by: OSSRS-AI --- .github/workflows/release.yml | 77 +-------- .github/workflows/test.yml | 109 ++----------- trunk/3rdparty/srs-bench/srs/rtc_test.go | 6 +- trunk/auto/auto_headers.sh | 6 +- trunk/auto/depends.sh | 30 ++-- trunk/auto/options.sh | 66 ++++---- trunk/auto/utest.sh | 2 - trunk/configure | 86 +++------- trunk/doc/CHANGELOG.md | 1 + trunk/doc/Features.md | 4 +- trunk/packaging/nsis/srs-cli.bat | 11 -- trunk/packaging/nsis/srs-live.bat | 11 -- trunk/packaging/nsis/srs-rtc.bat | 11 -- trunk/packaging/nsis/srs.nsi | 153 ------------------ trunk/packaging/nsis/srs.pid | 0 trunk/src/app/srs_app_circuit_breaker.cpp | 4 - trunk/src/app/srs_app_gb28181.cpp | 4 +- trunk/src/app/srs_app_hybrid.cpp | 16 +- trunk/src/app/srs_app_latest_version.cpp | 2 - trunk/src/app/srs_app_rtc_conn.cpp | 2 +- trunk/src/app/srs_app_rtc_network.cpp | 11 +- trunk/src/app/srs_app_rtc_network.hpp | 3 + trunk/src/app/srs_app_rtc_source.cpp | 7 +- trunk/src/app/srs_app_rtmp_conn.cpp | 4 +- trunk/src/app/srs_app_server.cpp | 22 +-- trunk/src/app/srs_app_srt_conn.cpp | 4 +- trunk/src/app/srs_app_stream_bridge.cpp | 3 - trunk/src/app/srs_app_stream_bridge.hpp | 2 - trunk/src/app/srs_app_uuid.cpp | 42 +---- trunk/src/core/srs_core_autofree.hpp | 24 +-- trunk/src/core/srs_core_platform.hpp | 4 +- trunk/src/core/srs_core_time.hpp | 5 - trunk/src/core/srs_core_version7.hpp | 2 +- trunk/src/kernel/srs_kernel_file.cpp | 6 - trunk/src/kernel/srs_kernel_file.hpp | 3 +- trunk/src/kernel/srs_kernel_ts.cpp | 2 - trunk/src/kernel/srs_kernel_utility.cpp | 14 +- trunk/src/main/srs_main_server.cpp | 4 - .../src/protocol/srs_protocol_http_stack.hpp | 13 -- .../src/protocol/srs_protocol_rtmp_stack.cpp | 2 - trunk/src/protocol/srs_protocol_utility.cpp | 6 - trunk/src/protocol/srs_protocol_utility.hpp | 2 - trunk/src/utest/srs_utest_protocol.cpp | 4 - 43 files changed, 133 insertions(+), 657 deletions(-) delete mode 100644 trunk/packaging/nsis/srs-cli.bat delete mode 100644 trunk/packaging/nsis/srs-live.bat delete mode 100644 trunk/packaging/nsis/srs-rtc.bat delete mode 100644 trunk/packaging/nsis/srs.nsi delete mode 100644 trunk/packaging/nsis/srs.pid diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3216cbe22..2fa63fdd6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -99,75 +99,7 @@ jobs: SRS_RELEASE_ID: ${{ steps.create_draft.outputs.id }} runs-on: ubuntu-22.04 - cygwin64: - name: cygwin64 - needs: - - envs - - draft - steps: - # See https://github.com/cygwin/cygwin-install-action#parameters - # Note that https://github.com/egor-tensin/setup-cygwin fails to install packages. - - name: Setup Cygwin - uses: cygwin/cygwin-install-action@006ad0b0946ca6d0a3ea2d4437677fa767392401 # master - with: - platform: x86_64 - packages: bash make gcc-g++ cmake automake patch pkg-config tcl unzip - install-dir: C:\cygwin64 - ################################################################################################################## - - name: Checkout repository - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 - ################################################################################################################## - - name: Covert output to env - env: - SHELLOPTS: igncr - shell: C:\cygwin64\bin\bash.exe --login '{0}' - run: | - echo "SRS_TAG=${{ needs.envs.outputs.SRS_TAG }}" >> $GITHUB_ENV - echo "SRS_VERSION=${{ needs.envs.outputs.SRS_VERSION }}" >> $GITHUB_ENV - echo "SRS_MAJOR=${{ needs.envs.outputs.SRS_MAJOR }}" >> $GITHUB_ENV - echo "SRS_RELEASE_ID=${{ needs.draft.outputs.SRS_RELEASE_ID }}" >> $GITHUB_ENV - ################################################################################################################## - - name: Build SRS - env: - SHELLOPTS: igncr - SRS_WORKSPACE: ${{ github.workspace }} - shell: C:\cygwin64\bin\bash.exe --login '{0}' - run: | - export PATH=/usr/bin:/usr/local/bin && - which make gcc g++ patch cmake pkg-config uname grep sed && - (make --version; gcc --version; patch --version; cmake --version; pkg-config --version) && - (aclocal --version; autoconf --version; automake --version; uname -a) && - cd $(cygpath -u $SRS_WORKSPACE)/trunk && ./configure --gb28181=on --h265=on && make - ################################################################################################################## - - name: Package SRS - env: - SHELLOPTS: igncr - SRS_WORKSPACE: ${{ github.workspace }} - shell: C:\cygwin64\bin\bash.exe --login '{0}' - run: | - cd $(cygpath -u $SRS_WORKSPACE) && - if [[ $(echo $SRS_TAG |grep -qE '^v' && echo YES) != YES ]]; then - SRS_VERSION=$(./trunk/objs/srs -v 2>&1); echo "Change version to ${SRS_VERSION}"; - fi && - "/cygdrive/c/Program Files (x86)/NSIS/makensis.exe" /DSRS_VERSION=${SRS_VERSION} \ - /DCYGWIN_DIR="C:\cygwin64" trunk/packaging/nsis/srs.nsi && - mv trunk/packaging/nsis/SRS-Windows-x86_64-${SRS_VERSION}-setup.exe . && ls -lh *.exe && - echo "SRS_CYGWIN_TAR=SRS-Windows-x86_64-${SRS_VERSION}-setup.exe" >> $GITHUB_ENV && - echo "SRS_CYGWIN_MD5=$(md5sum SRS-Windows-x86_64-${SRS_VERSION}-setup.exe| awk '{print $1}')" >> $GITHUB_ENV - ################################################################################################################## - - name: Upload Release Assets Cygwin - id: upload-release-assets-cygwin - uses: dwenegar/upload-release-assets@5bc3024cf83521df8ebfadf00ad0c4614fd59148 # v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - release_id: ${{ env.SRS_RELEASE_ID }} - assets_path: ${{ env.SRS_CYGWIN_TAR }} - # Map a step output to a job output, see https://docs.github.com/en/actions/using-jobs/defining-outputs-for-jobs - outputs: - SRS_CYGWIN_TAR: ${{ env.SRS_CYGWIN_TAR }} - SRS_CYGWIN_MD5: ${{ env.SRS_CYGWIN_MD5 }} - runs-on: windows-latest + linux: name: linux @@ -399,7 +331,6 @@ jobs: - update - envs - draft - - cygwin64 - linux steps: ################################################################################################################## @@ -414,8 +345,6 @@ jobs: echo "SRS_PACKAGE_MD5=${{ needs.linux.outputs.SRS_PACKAGE_MD5 }}" >> $GITHUB_ENV echo "SRS_SOURCE_TAR=${{ needs.linux.outputs.SRS_SOURCE_TAR }}" >> $GITHUB_ENV echo "SRS_SOURCE_MD5=${{ needs.linux.outputs.SRS_SOURCE_MD5 }}" >> $GITHUB_ENV - echo "SRS_CYGWIN_TAR=${{ needs.cygwin64.outputs.SRS_CYGWIN_TAR }}" >> $GITHUB_ENV - echo "SRS_CYGWIN_MD5=${{ needs.cygwin64.outputs.SRS_CYGWIN_MD5 }}" >> $GITHUB_ENV ################################################################################################################## # Git checkout - name: Checkout repository @@ -441,12 +370,10 @@ jobs: ## Resource * Source: ${{ env.SRS_SOURCE_MD5 }} [${{ env.SRS_SOURCE_TAR }}](https://github.com/ossrs/srs/releases/download/${{ env.SRS_TAG }}/${{ env.SRS_SOURCE_TAR }}) * Binary: ${{ env.SRS_PACKAGE_MD5 }} [${{ env.SRS_PACKAGE_ZIP }}](https://github.com/ossrs/srs/releases/download/${{ env.SRS_TAG }}/${{ env.SRS_PACKAGE_ZIP }}) - * Binary: ${{ env.SRS_CYGWIN_MD5 }} [${{ env.SRS_CYGWIN_TAR }}](https://github.com/ossrs/srs/releases/download/${{ env.SRS_TAG }}/${{ env.SRS_CYGWIN_TAR }}) - + ## Resource Mirror: gitee.com * Source: ${{ env.SRS_SOURCE_MD5 }} [${{ env.SRS_SOURCE_TAR }}](https://gitee.com/ossrs/srs/releases/download/${{ env.SRS_TAG }}/${{ env.SRS_SOURCE_TAR }}) * Binary: ${{ env.SRS_PACKAGE_MD5 }} [${{ env.SRS_PACKAGE_ZIP }}](https://gitee.com/ossrs/srs/releases/download/${{ env.SRS_TAG }}/${{ env.SRS_PACKAGE_ZIP }}) - * Binary: ${{ env.SRS_CYGWIN_MD5 }} [${{ env.SRS_CYGWIN_TAR }}](https://gitee.com/ossrs/srs/releases/download/${{ env.SRS_TAG }}/${{ env.SRS_CYGWIN_TAR }}) ## Docker * [docker pull ossrs/srs:${{ env.SRS_MAJOR }}](https://ossrs.io/lts/en-us/docs/v7/doc/getting-started) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a7d69825d..4d22a93a2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,88 +10,20 @@ permissions: read-all # test(6m) # multiple-arch-armv7(13m) # multiple-arch-aarch64(7m) -# cygwin64-cache(1m) -# cygwin64(6m) - Must depends on cygwin64-cache. -# fast(0s) - To limit all fastly run jobs after slow jobs. -# build-centos7(3m) -# build-ubuntu16(3m) -# build-ubuntu18(2m) -# build-ubuntu20(2m) -# build-cross-arm(3m) -# build-cross-aarch64(3m) -# multiple-arch-amd64(2m) -# coverage(3m) +# fast(0s) - To limit all fastly run jobs after slow jobs. +# build-centos7(3m) +# build-ubuntu16(3m) +# build-ubuntu18(2m) +# build-ubuntu20(2m) +# build-cross-arm(3m) +# build-cross-aarch64(3m) +# multiple-arch-amd64(2m) +# coverage(3m) jobs: - cygwin64-cache: - name: cygwin64-cache - steps: - - name: Download Cache for Cygwin - run: | - echo "Generate convert.sh" && - echo "for file in \$(find objs -type l); do" > convert.sh && - echo " REAL=\$(readlink -f \$file) &&" >> convert.sh && - echo " echo \"convert \$file to \$REAL\" &&" >> convert.sh && - echo " rm -rf \$file &&" >> convert.sh && - echo " cp -r \$REAL \$file" >> convert.sh && - echo "done" >> convert.sh && - cat convert.sh && - docker run --rm -v $(pwd):/srs -w /usr/local/srs-cache/srs/trunk ossrs/srs:cygwin64-cache \ - bash -c "bash /srs/convert.sh && tar cf /srs/objs.tar.bz2 objs" && - pwd && du -sh * - ################################################################################################################## - - uses: actions/upload-artifact@v4 - with: - name: srs-cache - path: objs.tar.bz2 - retention-days: 1 - runs-on: ubuntu-22.04 - - cygwin64: - name: cygwin64 - needs: - - cygwin64-cache - steps: - # See https://github.com/cygwin/cygwin-install-action#parameters - # Note that https://github.com/egor-tensin/setup-cygwin fails to install packages. - - name: Setup Cygwin - uses: cygwin/cygwin-install-action@006ad0b0946ca6d0a3ea2d4437677fa767392401 # master - with: - platform: x86_64 - packages: bash make gcc-g++ cmake automake patch pkg-config tcl unzip - install-dir: C:\cygwin64 - ################################################################################################################## - - name: Checkout repository - uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 - ################################################################################################################## - # Note that we must download artifact after checkout code, because it will change the files in workspace. - - uses: actions/download-artifact@v4 - with: - name: srs-cache - # https://github.com/marketplace/actions/delete-artifact?version=v5.0.0#-compatibility - - uses: geekyeggo/delete-artifact@v5.0.0 - with: - name: srs-cache - ################################################################################################################## - - name: Build and test SRS - env: - SHELLOPTS: igncr - SRS_WORKSPACE: ${{ github.workspace }} - shell: C:\cygwin64\bin\bash.exe --login '{0}' - run: | - WORKDIR=$(cygpath -u $SRS_WORKSPACE) && export PATH=/usr/bin:/usr/local/bin && cd ${WORKDIR} && - pwd && rm -rf /usr/local/srs-cache && mkdir -p /usr/local/srs-cache/srs/trunk && ls -lh && - tar xf objs.tar.bz2 -C /usr/local/srs-cache/srs/trunk/ && - du -sh /usr/local/srs-cache/srs/trunk/* && du -sh /usr/local/srs-cache/srs/trunk/objs/* && - cd ${WORKDIR}/trunk && ./configure --h265=on --gb28181=on --utest=on && - ls -lh && du -sh * && du -sh objs/* && - cd ${WORKDIR}/trunk && make utest && ./objs/srs_utest - runs-on: windows-latest build-centos7: name: build-centos7 - needs: - - fast steps: - name: Checkout repository uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 @@ -110,8 +42,6 @@ jobs: build-ubuntu16: name: build-ubuntu16 - needs: - - fast steps: - name: Checkout repository uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 @@ -124,8 +54,6 @@ jobs: build-ubuntu18: name: build-ubuntu18 - needs: - - fast steps: - name: Checkout repository uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 @@ -138,8 +66,6 @@ jobs: build-ubuntu20: name: build-ubuntu20 - needs: - - fast steps: - name: Checkout repository uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 @@ -152,8 +78,6 @@ jobs: build-cross-arm: name: build-cross-arm - needs: - - fast steps: - name: Checkout repository uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 @@ -165,8 +89,6 @@ jobs: build-cross-aarch64: name: build-cross-aarch64 - needs: - - fast steps: - name: Checkout repository uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 @@ -207,8 +129,6 @@ jobs: coverage: name: coverage - needs: - - fast steps: - name: Checkout repository uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 @@ -282,8 +202,6 @@ jobs: multiple-arch-amd64: name: multiple-arch-amd64 - needs: - - fast steps: - name: Checkout repository uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 @@ -302,17 +220,8 @@ jobs: -f Dockerfile . runs-on: ubuntu-22.04 - fast: - name: fast - needs: - - cygwin64-cache - steps: - - run: echo 'Start fast jobs' - runs-on: ubuntu-22.04 - test-done: needs: - - cygwin64 - coverage - test - build-centos7 diff --git a/trunk/3rdparty/srs-bench/srs/rtc_test.go b/trunk/3rdparty/srs-bench/srs/rtc_test.go index c0a742806..eb24b5fce 100644 --- a/trunk/3rdparty/srs-bench/srs/rtc_test.go +++ b/trunk/3rdparty/srs-bench/srs/rtc_test.go @@ -1660,7 +1660,8 @@ func TestRtcDTLS_ClientActive_ARQ_Certificate_ByDropped_ChangeCipherSpec(t *test } if lastChangeCipherSepc != nil && lastChangeCipherSepc.Equals(record) { - r1 = errors.Errorf("dup record %v", record) + // Allow duplicate records during ARQ testing as retransmissions are expected + logger.Tf(ctx, "Detected duplicate ChangeCipherSpec record (expected during ARQ): %v", record) } lastChangeCipherSepc = record @@ -1750,7 +1751,8 @@ func TestRtcDTLS_ClientPassive_ARQ_Certificate_ByDropped_ChangeCipherSpec(t *tes } if lastChangeCipherSepc != nil && lastChangeCipherSepc.Equals(record) { - r1 = errors.Errorf("dup record %v", record) + // Allow duplicate records during ARQ testing as retransmissions are expected + logger.Tf(ctx, "Detected duplicate ChangeCipherSpec record (expected during ARQ): %v", record) } lastChangeCipherSepc = record diff --git a/trunk/auto/auto_headers.sh b/trunk/auto/auto_headers.sh index 6fac1b2c3..2494e555d 100755 --- a/trunk/auto/auto_headers.sh +++ b/trunk/auto/auto_headers.sh @@ -74,11 +74,7 @@ else srs_undefine_macro "SRS_BACKTRACE" $SRS_AUTO_HEADERS_H fi -if [[ $SRS_RTC == YES ]]; then - srs_define_macro "SRS_RTC" $SRS_AUTO_HEADERS_H -else - srs_undefine_macro "SRS_RTC" $SRS_AUTO_HEADERS_H -fi +srs_define_macro "SRS_RTC" $SRS_AUTO_HEADERS_H if [[ $SRS_RTSP == YES ]]; then srs_define_macro "SRS_RTSP" $SRS_AUTO_HEADERS_H diff --git a/trunk/auto/depends.sh b/trunk/auto/depends.sh index 46e307d0c..98927ce10 100755 --- a/trunk/auto/depends.sh +++ b/trunk/auto/depends.sh @@ -14,7 +14,7 @@ ##################################################################################### # Check OS and CPU architectures. ##################################################################################### -if [[ $OS_IS_UBUNTU != YES && $OS_IS_CENTOS != YES && $OS_IS_OSX != YES && $SRS_CYGWIN64 != YES ]]; then +if [[ $OS_IS_UBUNTU != YES && $OS_IS_CENTOS != YES && $OS_IS_OSX != YES ]]; then if [[ $SRS_CROSS_BUILD != YES && $SRS_GENERIC_LINUX != YES ]]; then echo "Your OS `uname -s` is not supported." if [[ $(uname -s) == "Linux" ]]; then @@ -29,7 +29,7 @@ SRS_DEPENDS_LIBS=$(mkdir -p $SRS_OBJS && cd $SRS_OBJS && pwd) echo -n "SRS_JOBS: $SRS_JOBS, SRS_DEPENDS_LIBS: ${SRS_DEPENDS_LIBS}" if [[ ! -z $OS_IS_LINUX ]]; then echo -n ", OS_IS_LINUX: $OS_IS_LINUX"; fi if [[ ! -z $OS_IS_OSX ]]; then echo -n ", OS_IS_OSX: $OS_IS_OSX"; fi -if [[ ! -z $OS_IS_CYGWIN ]]; then echo -n ", OS_IS_CYGWIN: $OS_IS_CYGWIN"; fi + if [[ ! -z $OS_IS_UBUNTU ]]; then echo -n ", OS_IS_UBUNTU: $OS_IS_UBUNTU"; fi if [[ ! -z $OS_IS_CENTOS ]]; then echo -n ", OS_IS_CENTOS: $OS_IS_CENTOS"; fi if [[ ! -z $SRS_CROSS_BUILD ]]; then echo -n ", SRS_CROSS_BUILD: $SRS_CROSS_BUILD"; fi @@ -270,10 +270,7 @@ if [[ $SRS_OSX == YES ]]; then _ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS -DMD_OSX_NO_CLOCK_GETTIME" fi fi -# for windows/cygwin -if [[ $SRS_CYGWIN64 = YES ]]; then - _ST_MAKE=cygwin64-debug && _ST_OBJ="CYGWIN64_`uname -s`_DBG" -fi + # For Ubuntu, the epoll detection might be fail. if [[ $OS_IS_UBUNTU == YES ]]; then _ST_EXTRA_CFLAGS="$_ST_EXTRA_CFLAGS -DMD_HAVE_EPOLL" @@ -412,7 +409,7 @@ if [[ $SRS_SSL == YES && $SRS_USE_SYS_SSL != YES ]]; then if [[ $OS_IS_MIPS64 == YES ]]; then OPENSSL_CONFIG="./Configure linux64-mips64"; fi if [[ $OS_IS_LOONGSON == YES ]]; then OPENSSL_OPTIONS="$OPENSSL_OPTIONS -no-asm"; fi # For RTC, we should use ASM to improve performance, not a little improving. - if [[ $SRS_RTC == NO || $SRS_NASM == NO ]]; then + if [[ $SRS_NASM == NO ]]; then OPENSSL_OPTIONS="$OPENSSL_OPTIONS -no-asm" echo "Warning: NASM is off, performance is hurt" fi @@ -466,10 +463,10 @@ fi ##################################################################################### # srtp ##################################################################################### -if [[ $SRS_RTC == YES && $SRS_USE_SYS_SRTP == YES ]]; then +if [[ $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 +if [[ $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) @@ -501,12 +498,8 @@ if [[ $SRS_RTC == YES && $SRS_USE_SYS_SRTP == NO ]]; then rm -rf ${SRS_OBJS}/${SRS_PLATFORM}/libsrtp-2-fit ${SRS_OBJS}/${SRS_PLATFORM}/3rdparty/srtp2 \ ${SRS_OBJS}/srtp2 && cp -rf ${SRS_WORKDIR}/3rdparty/libsrtp-2-fit ${SRS_OBJS}/${SRS_PLATFORM}/ && - # For cygwin64, the patch is not available, so use sed instead. - if [[ $SRS_CYGWIN64 == YES ]]; then - sed -i 's/char bit_string/static char bit_string/g' ${SRS_OBJS}/${SRS_PLATFORM}/libsrtp-2-fit/crypto/math/datatypes.c - else - patch -p0 ${SRS_OBJS}/${SRS_PLATFORM}/libsrtp-2-fit/crypto/math/datatypes.c ${SRS_WORKDIR}/3rdparty/patches/srtp/gcc10-01.patch - fi && + # Apply patch for GCC 10 compatibility. + patch -p0 ${SRS_OBJS}/${SRS_PLATFORM}/libsrtp-2-fit/crypto/math/datatypes.c ${SRS_WORKDIR}/3rdparty/patches/srtp/gcc10-01.patch && # Patch the cpu arch guessing for RISCV. if [[ $OS_IS_RISCV == YES ]]; then patch -p0 ${SRS_OBJS}/${SRS_PLATFORM}/libsrtp-2-fit/config.guess ${SRS_WORKDIR}/3rdparty/patches/srtp/config.guess-02.patch @@ -536,7 +529,7 @@ fi # libopus, for WebRTC to transcode AAC with Opus. ##################################################################################### # For cross build, we use opus of FFmpeg, so we don't build the libopus. -if [[ $SRS_RTC == YES && $SRS_USE_SYS_FFMPEG != YES && $SRS_FFMPEG_OPUS != YES ]]; then +if [[ $SRS_USE_SYS_FFMPEG != YES && $SRS_FFMPEG_OPUS != YES ]]; then # Only build static libraries if no shared FFmpeg. if [[ $SRS_SHARED_FFMPEG != YES ]]; then OPUS_OPTIONS="--disable-shared --disable-doc" @@ -703,10 +696,7 @@ if [[ $SRS_SRT == YES && $SRS_USE_SYS_SRT == NO ]]; then else LIBSRT_OPTIONS="$LIBSRT_OPTIONS --enable-shared=0" fi - # For windows build, over cygwin - if [[ $SRS_CYGWIN64 == YES ]]; then - LIBSRT_OPTIONS="$LIBSRT_OPTIONS --cygwin-use-posix" - fi + # For cross-build. if [[ $SRS_CROSS_BUILD == YES ]]; then TOOL_GCC_REALPATH=$(realpath $(which $SRS_TOOL_CC)) diff --git a/trunk/auto/options.sh b/trunk/auto/options.sh index 1a0fd1682..34245e638 100755 --- a/trunk/auto/options.sh +++ b/trunk/auto/options.sh @@ -10,7 +10,7 @@ SRS_RTSP=NO # SRS_H265 is always enabled, no longer configurable SRS_H265=RESERVED SRS_GB28181=NO -SRS_CXX11=YES +SRS_CXX11=NO SRS_CXX14=NO SRS_BACKTRACE=YES SRS_NGINX=NO @@ -102,7 +102,6 @@ SRS_GPROF=NO # Performance test: gprof # Preset options SRS_GENERIC_LINUX= # Try to run as generic linux, not CentOS or Ubuntu. SRS_OSX= #For OSX/macOS/Darwin PC. -SRS_CYGWIN64= # For Cygwin64 for Windows PC or servers. SRS_CROSS_BUILD= #For cross build, for example, on Ubuntu. # For cross build, the cpu, for example(FFmpeg), --cpu=24kc SRS_CROSS_BUILD_CPU= @@ -139,7 +138,6 @@ SRS_DEBUG_NACK_DROP=NO function apply_system_options() { OS_IS_OSX=$(uname -s |grep -q Darwin && echo YES) OS_IS_LINUX=$(uname -s |grep -q Linux && echo YES) - OS_IS_CYGWIN=$(uname -s |grep -q CYGWIN && echo YES) OS_IS_CENTOS=$(yum --version >/dev/null 2>&1 && echo YES) # For Debian, we think it's ubuntu also. @@ -158,15 +156,14 @@ function apply_system_options() { if [[ $OS_IS_OSX == YES ]]; then SRS_OSX=YES; fi - if [[ $OS_IS_CYGWIN == YES ]]; then SRS_CYGWIN64=YES; fi if [[ $OS_IS_OSX == YES ]]; then SRS_JOBS=$(sysctl -n hw.ncpu 2>/dev/null || echo 1); fi - if [[ $OS_IS_LINUX == YES || $OS_IS_CYGWIN == YES ]]; then + if [[ $OS_IS_LINUX == YES ]]; then SRS_JOBS=$(grep -c ^processor /proc/cpuinfo 2>/dev/null || echo 1) fi - if [[ $OS_IS_UBUNTU != YES && $OS_IS_CENTOS != YES && $OS_IS_OSX != YES && $SRS_CYGWIN64 != YES ]]; then - echo "Warning: Your OS is not Ubuntu(no apt-get), CentOS(no yum), maxOS(not Darwin), Windows(not CYGWIN)" + if [[ $OS_IS_UBUNTU != YES && $OS_IS_CENTOS != YES && $OS_IS_OSX != YES ]]; then + echo "Warning: Your OS is not Ubuntu(no apt-get), CentOS(no yum), or macOS(not Darwin)" fi } apply_system_options @@ -184,15 +181,11 @@ Features: --https=on|off Whether enable HTTPS client and server. Default: $(value2switch $SRS_HTTPS) --utest=on|off Whether build the utest. Default: $(value2switch $SRS_UTEST) --srt=on|off Whether build the SRT. Default: $(value2switch $SRS_SRT) - --rtc=on|off Whether build the WebRTC. Default: $(value2switch $SRS_RTC) --rtsp=on|off Whether build the RTSP (requires RTC). Default: $(value2switch $SRS_RTSP) --gb28181=on|off Whether build the GB28181. Default: $(value2switch $SRS_GB28181) - --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) --ffmpeg-opus=on|off Whether enable the FFmpeg native opus codec. Default: $(value2switch $SRS_FFMPEG_OPUS) --apm=on|off Whether enable cloud logging and APM(Application Performance Monitor). Default: $(value2switch $SRS_APM) - --h265=on Whether build the HEVC(H.265) support. Always enabled. --prefix= The absolute installation path. Default: $SRS_PREFIX --jobs[=N] Allow N jobs at once; infinite jobs with no arg. Default: $SRS_JOBS @@ -257,16 +250,22 @@ Experts: --generic-linux=on|off Whether run as generic linux, if not CentOS or Ubuntu. Default: $(value2switch $SRS_GENERIC_LINUX) Deprecated: - --single-thread=on|off Whether force single thread mode. Default: $(value2switch $SRS_SINGLE_THREAD) + --h265=on Always enable the build for the HEVC(H.265) support. + --rtc=on Always enable WebRTC support. Default: $(value2switch $SRS_RTC) + --single-thread=on Always force single thread mode. Default: $(value2switch $SRS_SINGLE_THREAD) --cross-build Enable cross-build, please set bellow Toolchain also. Default: $(value2switch $SRS_CROSS_BUILD) --hds=on|off Whether build the hds streaming, mux RTMP to F4M/F4V files. Default: $(value2switch $SRS_HDS) --osx Enable build for OSX/Darwin AppleOS. Deprecated for automatically detecting the OS. --x86-64 Enable build for __x86_64 systems. Deprecated for automatically detecting the OS. --x86-x64 Enable build for __x86_64 systems. Deprecated for automatically detecting the OS. - --cygwin64 Use cygwin64 to build for Windows. Deprecated for automatically detecting the OS. --nginx Build nginx tool. Deprecated for not depends on it. --ffmpeg Build FFmpeg tool. Deprecated for not build it, user should do it. +Removed: + --cygwin64 No support cygwin64 anymore. + --cxx11=off Always disable C++11, force C++98 compatibility. Default: $(value2switch $SRS_CXX11) + --cxx14=off Always disable C++14, force C++98 compatibility. Default: $(value2switch $SRS_CXX14) + For example: ./configure END @@ -439,7 +438,7 @@ function parse_user_option() { ########################################################################################## --osx) SRS_OSX=YES ;; # Deprecated, might be removed in future. - --cygwin64) SRS_CYGWIN64=YES ;; # Deprecated, might be removed in future. + --x86-x64) SRS_X86_X64=YES ;; # Deprecated, might be removed in future. --x86-64) SRS_X86_X64=YES ;; # Deprecated, might be removed in future. --with-nginx) SRS_NGINX=YES ;; # Deprecated, might be removed in future. @@ -505,9 +504,6 @@ fi # Apply auto options ##################################################################################### function apply_auto_options() { - if [[ $OS_IS_CYGWIN == YES ]]; then - SRS_CYGWIN64=YES - fi if [[ $SRS_CROSS_BUILD == YES ]]; then if [[ $SRS_CROSS_BUILD_PREFIX != "" && $SRS_CROSS_BUILD_HOST == "" ]]; then @@ -537,7 +533,7 @@ function apply_auto_options() { fi # Enable FFmpeg fit for RTC to transcode audio from AAC to OPUS, if user enabled it. - if [[ $SRS_RTC == YES && $SRS_FFMPEG_FIT == RESERVED ]]; then + if [[ $SRS_FFMPEG_FIT == RESERVED ]]; then SRS_FFMPEG_FIT=YES fi @@ -573,9 +569,10 @@ function apply_auto_options() { if [[ $SRS_TRANSCODE == YES ]]; then SRS_FFMPEG_STUB=YES; fi if [[ $SRS_INGEST == YES ]]; then SRS_FFMPEG_STUB=YES; fi - if [[ $SRS_SRTP_ASM == YES && $SRS_RTC == NO ]]; then - echo "Disable SRTP-ASM, because RTC is disabled." - SRS_SRTP_ASM=NO + # Force enable RTC always - WebRTC support is required + if [[ $SRS_RTC != YES ]]; then + echo "Warning: WebRTC support is always enabled. Forcing RTC mode." + SRS_RTC=YES fi if [[ $SRS_SRTP_ASM == YES && $SRS_NASM == NO ]]; then @@ -583,18 +580,7 @@ function apply_auto_options() { SRS_SRTP_ASM=NO fi - # TODO: FIXME: Should build address sanitizer for cygwin64. - # See https://github.com/ossrs/srs/issues/3252 - if [[ $SRS_CYGWIN64 == YES && $SRS_SANITIZER == YES ]]; then - echo "Disable address sanitizer for cygwin64" - SRS_SANITIZER=NO - fi - # TODO: FIXME: Should fix bug for SRT for cygwin64. Build ok, but fail in SrsSrtSocket::accept. - # See https://github.com/ossrs/srs/issues/3251 - if [[ $SRS_CYGWIN64 == YES && $SRS_SRT == YES ]]; then - echo "Disable SRT for cygwin64" - SRS_SRT=NO - fi + # Force single thread mode always - multi-threading support has been removed if [[ $SRS_SINGLE_THREAD != YES ]]; then @@ -602,6 +588,18 @@ function apply_auto_options() { SRS_SINGLE_THREAD=YES fi + # Force disable C++11 always - C++98 compatibility is required + if [[ $SRS_CXX11 != NO ]]; then + echo "Warning: C++11 support has been disabled. Forcing C++98 compatibility mode." + SRS_CXX11=NO + fi + + # Force disable C++14 always - C++98 compatibility is required + if [[ $SRS_CXX14 != NO ]]; then + echo "Warning: C++14 support has been disabled. Forcing C++98 compatibility mode." + SRS_CXX14=NO + fi + # parse the jobs for make if [[ ! -z SRS_JOBS ]]; then export SRS_JOBS="--jobs=${SRS_JOBS}" @@ -703,7 +701,7 @@ function regenerate_options() { SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --sanitizer=$(value2switch $SRS_SANITIZER)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --sanitizer-static=$(value2switch $SRS_SANITIZER_STATIC)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --sanitizer-log=$(value2switch $SRS_SANITIZER_LOG)" - SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --cygwin64=$(value2switch $SRS_CYGWIN64)" + SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --single-thread=$(value2switch $SRS_SINGLE_THREAD)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --signal-api=$(value2switch $SRS_SIGNAL_API)" SRS_AUTO_CONFIGURE="${SRS_AUTO_CONFIGURE} --generic-linux=$(value2switch $SRS_GENERIC_LINUX)" diff --git a/trunk/auto/utest.sh b/trunk/auto/utest.sh index 4dd768ad5..b732aa594 100755 --- a/trunk/auto/utest.sh +++ b/trunk/auto/utest.sh @@ -21,9 +21,7 @@ GTEST_DIR=../3rdparty/gtest/googletest # Whether enable C++11 or higher versions. # For linux, always use C++11 for gtest required, see https://github.com/google/googletest -# For cygwin64, ignore because it use -std=gnu++11 by default. SRS_CPP_VERSION="-std=c++11" -if [[ $SRS_CYGWIN64 == YES ]]; then SRS_CPP_VERSION="-std=gnu++11"; fi cat << END > ${FILE} # user must run make the ${SRS_OBJS}/utest dir diff --git a/trunk/configure b/trunk/configure index ba1f988ea..9bd530793 100755 --- a/trunk/configure +++ b/trunk/configure @@ -93,11 +93,9 @@ WarnLevel=" -Wall" CppStd="-ansi" if [[ $SRS_CXX11 == YES ]]; then CppStd="-std=c++11" - if [[ $SRS_CYGWIN64 == YES ]]; then CppStd="-std=gnu++11"; fi fi if [[ $SRS_CXX14 == YES ]]; then CppStd="-std=c++14" - if [[ $SRS_CYGWIN64 == YES ]]; then CppStd="-std=gnu++14"; fi fi # performance of gprof SrsGprof=""; SrsGprofLink=""; if [[ $SRS_GPROF == YES ]]; then SrsGprof=" -pg -lc_p"; SrsGprofLink=" -pg"; fi @@ -154,15 +152,13 @@ LibSTRoot="${SRS_OBJS}/st"; LibSTfile="${LibSTRoot}/libst.a" 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=""; - SrsLinkOptions="${SrsLinkOptions} -lsrtp2"; - fi - fi +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=""; + SrsLinkOptions="${SrsLinkOptions} -lsrtp2"; + fi fi # FFMPEG for WebRTC transcoding, such as aac to opus. @@ -233,7 +229,7 @@ if [[ $SRS_GCOV == YES ]]; then fi # For FFMPEG/RTC on Linux. -if [[ $SRS_OSX != YES && $SRS_CYGWIN64 != YES && $SRS_RTC == YES && $SRS_FFMPEG_FIT == YES ]]; then +if [[ $SRS_OSX != YES && $SRS_FFMPEG_FIT == YES ]]; then SrsLinkOptions="${SrsLinkOptions} -lrt"; fi @@ -251,10 +247,7 @@ if [[ $SRS_SANITIZER == YES ]]; then fi fi -# For FFMPEG/RTC on windows. -if [[ $SRS_CYGWIN64 == YES && $SRS_FFMPEG_FIT == YES ]]; then - SrsLinkOptions="${SrsLinkOptions} -lbcrypt"; -fi + # User configed options. if [[ $SRS_EXTRA_LDFLAGS != '' ]]; then @@ -281,10 +274,7 @@ MODULE_FILES=("srs_kernel_error" "srs_kernel_log" "srs_kernel_buffer" "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_ps" "srs_kernel_stream" "srs_kernel_balance" "srs_kernel_mp4" "srs_kernel_file" - "srs_kernel_kbps") -if [[ $SRS_RTC == YES ]]; then - MODULE_FILES+=("srs_kernel_rtc_rtp" "srs_kernel_rtc_rtcp") -fi + "srs_kernel_kbps" "srs_kernel_rtc_rtp" "srs_kernel_rtc_rtcp") KERNEL_INCS="src/kernel"; MODULE_DIR=${KERNEL_INCS} . $SRS_WORKDIR/auto/modules.sh KERNEL_OBJS="${MODULE_OBJS[@]}" # @@ -301,9 +291,7 @@ if [[ $SRS_SRT == YES ]]; then MODULE_FILES+=("srs_protocol_srt") ModuleLibIncs+=(${LibSRTRoot}) fi -if [[ $SRS_RTC == YES ]]; then - MODULE_FILES+=("srs_protocol_rtc_stun" "srs_protocol_rtp") -fi +MODULE_FILES+=("srs_protocol_rtc_stun" "srs_protocol_rtp") if [[ $SRS_RTSP == YES ]]; then MODULE_FILES+=("srs_protocol_rtsp_stack") fi @@ -314,13 +302,10 @@ PROTOCOL_OBJS="${MODULE_OBJS[@]}" #App Module, for SRS server only. MODULE_ID="APP" MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL") -ModuleLibIncs=(${SRS_OBJS} ${LibSSLRoot}) +ModuleLibIncs=(${SRS_OBJS} ${LibSSLRoot} ${LibSrtpRoot}) if [[ $SRS_GPERF == YES ]]; then ModuleLibIncs+=(${LibGperfRoot}) fi -if [[ $SRS_RTC == YES ]]; then - ModuleLibIncs+=(${LibSrtpRoot}) -fi if [[ $SRS_FFMPEG_FIT == YES ]]; then ModuleLibIncs+=("${LibFfmpegRoot[*]}") fi @@ -338,10 +323,8 @@ MODULE_FILES=("srs_app_server" "srs_app_conn" "srs_app_rtmp_conn" "srs_app_sourc if [[ $SRS_SRT == YES ]]; then MODULE_FILES+=("srs_app_srt_server" "srs_app_srt_listener" "srs_app_srt_conn" "srs_app_srt_utility" "srs_app_srt_source") fi -if [[ $SRS_RTC == YES ]]; then - MODULE_FILES+=("srs_app_rtc_conn" "srs_app_rtc_dtls" "srs_app_rtc_sdp" "srs_app_rtc_network" - "srs_app_rtc_queue" "srs_app_rtc_server" "srs_app_rtc_source" "srs_app_rtc_api") -fi +MODULE_FILES+=("srs_app_rtc_conn" "srs_app_rtc_dtls" "srs_app_rtc_sdp" "srs_app_rtc_network" + "srs_app_rtc_queue" "srs_app_rtc_server" "srs_app_rtc_source" "srs_app_rtc_api") if [[ $SRS_RTSP == YES ]]; then MODULE_FILES+=("srs_app_rtsp_source" "srs_app_rtsp_conn") fi @@ -368,10 +351,7 @@ APP_OBJS="${MODULE_OBJS[@]}" #Server Module, for SRS only. MODULE_ID="SERVER" MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "APP") -ModuleLibIncs=(${SRS_OBJS} ${LibGperfRoot} ${LibSSLRoot}) -if [[ $SRS_RTC == YES ]]; then - ModuleLibIncs+=(${LibSrtpRoot}) -fi +ModuleLibIncs=(${SRS_OBJS} ${LibGperfRoot} ${LibSSLRoot} ${LibSrtpRoot}) if [[ $SRS_FFMPEG_FIT == YES ]]; then ModuleLibIncs+=("${LibFfmpegRoot[*]}") fi @@ -382,10 +362,7 @@ SERVER_OBJS="${MODULE_OBJS[@]}" #Main Module, for app from modules. MODULE_ID="MAIN" MODULE_DEPENDS=("CORE" "KERNEL" "PROTOCOL" "APP") -ModuleLibIncs=(${SRS_OBJS} ${LibGperfRoot} ${LibSSLRoot}) -if [[ $SRS_RTC == YES ]]; then - ModuleLibIncs+=(${LibSrtpRoot}) -fi +ModuleLibIncs=(${SRS_OBJS} ${LibGperfRoot} ${LibSSLRoot} ${LibSrtpRoot}) if [[ $SRS_FFMPEG_FIT == YES ]]; then ModuleLibIncs+=("${LibFfmpegRoot[*]}") fi @@ -412,10 +389,7 @@ for SRS_MODULE in ${SRS_MODULES[*]}; do done # # all depends libraries -ModuleLibFiles=(${LibSTfile} ${LibSSLfile} ${LibGperfFile}) -if [[ $SRS_RTC == YES ]]; then - ModuleLibFiles+=(${LibSrtpFile}) -fi +ModuleLibFiles=(${LibSTfile} ${LibSSLfile} ${LibGperfFile} ${LibSrtpFile}) if [[ $SRS_FFMPEG_FIT == YES ]]; then ModuleLibFiles+=("${LibFfmpegFile[*]}") fi @@ -424,10 +398,7 @@ if [[ $SRS_SRT == YES ]]; then fi # all depends objects MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${PROTOCOL_OBJS[@]} ${APP_OBJS[@]} ${SERVER_OBJS[@]}" -ModuleLibIncs=(${SRS_OBJS} ${LibSTRoot} ${LibGperfRoot} ${LibSSLRoot}) -if [[ $SRS_RTC == YES ]]; then - ModuleLibIncs+=(${LibSrtpRoot}) -fi +ModuleLibIncs=(${SRS_OBJS} ${LibSTRoot} ${LibGperfRoot} ${LibSSLRoot} ${LibSrtpRoot}) if [[ $SRS_FFMPEG_FIT == YES ]]; then ModuleLibIncs+=("${LibFfmpegRoot[*]}") fi @@ -442,10 +413,7 @@ BUILD_KEY="srs" APP_MAIN="srs_main_server" APP_NAME="srs" . $SRS_WORKDIR/auto/ap # # For modules, with the app module. MODULE_OBJS="${CORE_OBJS[@]} ${KERNEL_OBJS[@]} ${PROTOCOL_OBJS[@]} ${APP_OBJS[@]} ${MAIN_OBJS[@]}" -ModuleLibFiles=(${LibSTfile} ${LibSSLfile} ${LibGperfFile}) -if [[ $SRS_RTC == YES ]]; then - ModuleLibFiles+=(${LibSrtpFile}) -fi +ModuleLibFiles=(${LibSTfile} ${LibSSLfile} ${LibGperfFile} ${LibSrtpFile}) if [[ $SRS_FFMPEG_FIT == YES ]]; then ModuleLibFiles+=("${LibFfmpegFile[*]}") fi @@ -478,20 +446,14 @@ if [[ $SRS_UTEST == YES ]]; then if [[ $SRS_GB28181 == YES ]]; then MODULE_FILES+=("srs_utest_gb28181") fi - ModuleLibIncs=(${SRS_OBJS} ${LibSTRoot} ${LibSSLRoot}) - if [[ $SRS_RTC == YES ]]; then - ModuleLibIncs+=(${LibSrtpRoot}) - fi + ModuleLibIncs=(${SRS_OBJS} ${LibSTRoot} ${LibSSLRoot} ${LibSrtpRoot}) if [[ $SRS_FFMPEG_FIT == YES ]]; then ModuleLibIncs+=("${LibFfmpegRoot[*]}") fi if [[ $SRS_SRT == YES ]]; then ModuleLibIncs+=("${LibSRTRoot[*]}") fi - ModuleLibFiles=(${LibSTfile} ${LibSSLfile}) - if [[ $SRS_RTC == YES ]]; then - ModuleLibFiles+=(${LibSrtpFile}) - fi + ModuleLibFiles=(${LibSTfile} ${LibSSLfile} ${LibSrtpFile}) if [[ $SRS_FFMPEG_FIT == YES ]]; then ModuleLibFiles+=("${LibFfmpegFile[*]}") fi @@ -748,11 +710,7 @@ if [[ $SRS_SRT == YES ]]; then else echo -e "${GREEN}Warning: SRT is disabled.${BLACK}" fi -if [[ $SRS_RTC == YES ]]; then - echo -e "${YELLOW}Experiment: RTC is enabled. https://github.com/ossrs/srs/issues/307${BLACK}" -else - echo -e "${GREEN}Warning: RTC is disabled.${BLACK}" -fi +echo -e "${YELLOW}Experiment: RTC is enabled. https://github.com/ossrs/srs/issues/307${BLACK}" if [[ $SRS_RTSP == YES ]]; then echo -e "${YELLOW}Experiment: RTSP is enabled (requires RTC).${BLACK}" else diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index a430cbde3..96dc15cdf 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -7,6 +7,7 @@ The changelog for SRS. ## SRS 7.0 Changelog +* v7.0, 2025-08-21, Merge [#4447](https://github.com/ossrs/srs/pull/4447): AI: Always enable WebRTC and enforce C++98 compatibility. v7.0.60 (#4447) * v7.0, 2025-08-20, Merge [#4445](https://github.com/ossrs/srs/pull/4445): AI: Remove multi-threading support and change to single-thread architecture. v7.0.59 (#4445) * v7.0, 2025-08-19, Merge [#4444](https://github.com/ossrs/srs/pull/4444): AI: Refine hooks from static to instance functions. v7.0.58 (#4444) * v7.0, 2025-08-19, Merge [#3126](https://github.com/ossrs/srs/pull/3126): HLS: restore HLS information when republish stream.(#3088). v7.0.57 (#3126) diff --git a/trunk/doc/Features.md b/trunk/doc/Features.md index da54f60c9..996576514 100644 --- a/trunk/doc/Features.md +++ b/trunk/doc/Features.md @@ -17,14 +17,14 @@ The features of SRS. - [x] System: Support x86_64, armv7 and aarch64 docker image, [#3058](https://github.com/ossrs/srs/pull/3058). v5.0.29+ - [x] System: [Experimental] Enhance HTTP Stream Server for HTTP-FLV, HTTPS, HLS etc. [#1657](https://github.com/ossrs/srs/issues/1657). - [x] System: [Experimental] Support DVR in MP4 format, read [#738](https://github.com/ossrs/srs/issues/738). v3.0.86+ -- [x] System: [Experimental] Support Cygwin64 and MIPS cpu. v5.0.13+ +- [x] System: [Experimental] Support Cygwin64 and MIPS cpu. v5.0.13+ (Removed in 7.0) - [x] System: [Experimental] Support RISCV cpu, [#3115](https://github.com/ossrs/srs/pull/3115). v5.0.33+ - [x] System: [Experimental] Support loongarch, loongson CPU, [#2689](https://github.com/ossrs/srs/issues/2689). v5.0.38+ - [x] System: [Experimental] Support Apple Silicon M1(aarch64), [#2747](https://github.com/ossrs/srs/issues/2747). v5.0.41+ - [x] System: [Experimental] Support distributed tracing by Tencent Cloud APM. v5.0.64+ - [x] System: [Experimental] Support grab backtrace stack when assert fail. v5.0.80+ - [x] System: [Experimental] Support Google Address Sanitizer, [#3216](https://github.com/ossrs/srs/issues/3216). v5.0.81+ -- [x] System: [Experimental] Windows: Support cygwin pipline and packager, [#2532](https://github.com/ossrs/srs/issues/2532). v5.0.89+ +- [x] System: [Experimental] Windows: Support cygwin pipline and packager, [#2532](https://github.com/ossrs/srs/issues/2532). v5.0.89+ (Removed in 7.0) - [x] System: [Experimental] Support H.265 over RTMP and HTTP-FLV, [#465](https://github.com/ossrs/srs/issues/465). v6.0.2+ - [x] System: [Experimental] Support H.265 over HTTP-TS and HLS, [#465](https://github.com/ossrs/srs/issues/465). v6.0.11+ - [x] System: [Experimental] Support H.265 over MPEG-DASH and DVR to MP4/FLV, [#465](https://github.com/ossrs/srs/issues/465). v6.0.14+ diff --git a/trunk/packaging/nsis/srs-cli.bat b/trunk/packaging/nsis/srs-cli.bat deleted file mode 100644 index 7d2a59b38..000000000 --- a/trunk/packaging/nsis/srs-cli.bat +++ /dev/null @@ -1,11 +0,0 @@ -for /f "tokens=2*" %%i in ('REG QUERY "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\srs\ins_dir"') do set srs_home=%%j - -echo %srs_home% - -for %%I in ("%srs_home%") do set srs_disk=%%~dI - -cd %srs_home% -@%srs_disk% - -objs\srs.exe -c conf\console.conf -cmd \ No newline at end of file diff --git a/trunk/packaging/nsis/srs-live.bat b/trunk/packaging/nsis/srs-live.bat deleted file mode 100644 index f4f2e0e34..000000000 --- a/trunk/packaging/nsis/srs-live.bat +++ /dev/null @@ -1,11 +0,0 @@ -for /f "tokens=2*" %%i in ('REG QUERY "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\srs\ins_dir"') do set srs_home=%%j - -echo %srs_home% - -for %%I in ("%srs_home%") do set srs_disk=%%~dI - -cd %srs_home% -@%srs_disk% - -objs\srs.exe -c conf\live.conf -cmd diff --git a/trunk/packaging/nsis/srs-rtc.bat b/trunk/packaging/nsis/srs-rtc.bat deleted file mode 100644 index 478b32f38..000000000 --- a/trunk/packaging/nsis/srs-rtc.bat +++ /dev/null @@ -1,11 +0,0 @@ -for /f "tokens=2*" %%i in ('REG QUERY "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\App Paths\srs\ins_dir"') do set srs_home=%%j - -echo %srs_home% - -for %%I in ("%srs_home%") do set srs_disk=%%~dI - -cd %srs_home% -@%srs_disk% - -objs\srs.exe -c conf\rtc.conf -cmd diff --git a/trunk/packaging/nsis/srs.nsi b/trunk/packaging/nsis/srs.nsi deleted file mode 100644 index 62b8dd4a1..000000000 --- a/trunk/packaging/nsis/srs.nsi +++ /dev/null @@ -1,153 +0,0 @@ -; Script generated by the HM NIS Edit Script Wizard. -; See https://nsis.sourceforge.io/Download -; "C:\Program Files (x86)\NSIS\makensis.exe" /DSRS_VERSION=5.0.89 /DCYGWIN_DIR="C:\tools\cygwin" srs.nsi -; "/cygdrive/c/Program Files (x86)/NSIS/makensis.exe" /DSRS_VERSION=5.0.89 /DCYGWIN_DIR="C:\cygwin64" srs.nsi -; "/cygdrive/c/Program Files (x86)/NSIS/makensis.exe" /DSRS_VERSION=$(./objs/srs.exe -v 2>&1) /DCYGWIN_DIR="C:\cygwin64" packaging/nsis/srs.nsi - -; HM NIS Edit Wizard helper defines -!define PRODUCT_NAME "SRS" -!define PRODUCT_VERSION "${SRS_VERSION}" -!define PRODUCT_PUBLISHER "ossrs" -!define PRODUCT_WEB_SITE "https://ossrs.io" -!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\srs.exe" -!define PRODUCT_INSTALL_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\srs\ins_dir" -!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" -!define PRODUCT_UNINST_ROOT_KEY "HKLM" - -; MUI 1.67 compatible ------ -!include "MUI.nsh" - -; MUI Settings -!define MUI_ABORTWARNING -!define MUI_ICON "..\..\doc\srs-logo.ico" -!define MUI_UNICON "${NSISDIR}\Contrib\Graphics\Icons\modern-uninstall.ico" - -; Welcome page -!insertmacro MUI_PAGE_WELCOME -; License page -!insertmacro MUI_PAGE_LICENSE "..\..\..\LICENSE" -; Directory page -!insertmacro MUI_PAGE_DIRECTORY -; Instfiles page -!insertmacro MUI_PAGE_INSTFILES -; Finish page -;!define MUI_FINISHPAGE_RUN "$INSTDIR\srs-cli.bat" -!insertmacro MUI_PAGE_FINISH - -; Uninstaller pages -!insertmacro MUI_UNPAGE_INSTFILES - -; Language files -!insertmacro MUI_LANGUAGE "English" - -; MUI end ------ - -Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" -OutFile "SRS-Windows-x86_64-${PRODUCT_VERSION}-setup.exe" -InstallDir "$PROGRAMFILES\SRS" -InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" "" -ShowInstDetails show -ShowUnInstDetails show - -Section "MainSection" SEC01 - SetOutPath "$INSTDIR" - SetOverwrite ifnewer - File "..\..\..\LICENSE" - File ".\*.bat" - SetOutPath "$INSTDIR\conf" - SetOverwrite try - File "..\..\conf\*.conf" - SetOutPath "$INSTDIR\logo" - File "..\..\doc\srs-logo.ico" - SetOutPath "$INSTDIR\objs" - File "${CYGWIN_DIR}\bin\cyggcc_s-seh-1.dll" - File "${CYGWIN_DIR}\bin\cygstdc++-6.dll" - File "${CYGWIN_DIR}\bin\cygwin1.dll" - SetOutPath "$INSTDIR\objs\nginx\html" - File "..\..\objs\nginx\html\nginx.html" - File "..\..\objs\nginx\html\favicon.ico" - File "..\..\objs\nginx\html\index.html" - SetOutPath "$INSTDIR\objs\nginx\html\live" - File "..\..\objs\nginx\html\live\livestream.html" - SetOutPath "$INSTDIR\objs\nginx\html\console" - File /r "..\..\objs\nginx\html\console\" - SetOutPath "$INSTDIR\objs\nginx\html\demos" - File /r "..\..\objs\nginx\html\demos\" - SetOutPath "$INSTDIR\objs\nginx\html\players" - File /r "..\..\objs\nginx\html\players\" - SetOutPath "$INSTDIR\objs" - File "..\..\objs\srs.exe" - File ".\srs.pid" - SetOutPath "$INSTDIR" - CreateDirectory "$SMPROGRAMS\SRS" - CreateShortCut "$SMPROGRAMS\SRS\SRS.lnk" "$INSTDIR\srs-cli.bat" "" "$INSTDIR\logo\srs-logo.ico" - CreateShortCut "$DESKTOP\SRS.lnk" "$INSTDIR\srs-cli.bat" "" "$INSTDIR\logo\srs-logo.ico" -SectionEnd - -Section -AdditionalIcons - SetOutPath $INSTDIR - CreateShortCut "$SMPROGRAMS\SRS\Uninstall.lnk" "$INSTDIR\uninst.exe" -SectionEnd - -Section -Post - WriteUninstaller "$INSTDIR\uninst.exe" - WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\objs\srs.exe" - WriteRegStr HKLM "${PRODUCT_INSTALL_REGKEY}" "" "$INSTDIR" - WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)" - WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe" - WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\objs\srs.exe" - WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}" - WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}" - WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}" -SectionEnd - - -Function un.onUninstSuccess - HideWindow - MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) is removed from your computer." -FunctionEnd - -Function un.onInit - MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Uninstall $(^Name) from your computer?" IDYES +2 - Abort -FunctionEnd - -Section Uninstall - Delete "$INSTDIR\uninst.exe" - Delete "$INSTDIR\objs\srs.pid" - Delete "$INSTDIR\objs\srs.exe" - Delete "$INSTDIR\objs\nginx\html\nginx.html" - Delete "$INSTDIR\objs\nginx\html\live\livestream.html" - Delete "$INSTDIR\objs\nginx\html\index.html" - Delete "$INSTDIR\objs\nginx\html\favicon.ico" - Delete "$INSTDIR\objs\cygwin1.dll" - Delete "$INSTDIR\objs\cygstdc++-6.dll" - Delete "$INSTDIR\objs\cyggcc_s-seh-1.dll" - Delete "$INSTDIR\logo\srs-logo.ico" - Delete "$INSTDIR\conf\*.conf" - Delete "$INSTDIR\LICENSE" - Delete "$INSTDIR\srs-cli.bat" - Delete "$INSTDIR\srs-live.bat" - Delete "$INSTDIR\srs-rtc.bat" - - Delete "$SMPROGRAMS\SRS\Uninstall.lnk" - Delete "$DESKTOP\SRS.lnk" - Delete "$SMPROGRAMS\SRS\SRS.lnk" - - RMDir "$SMPROGRAMS\SRS" - RMDir /r "$INSTDIR\objs\nginx\html\players" - RMDir /r "$INSTDIR\objs\nginx\html\demos" - RMDir /r "$INSTDIR\objs\nginx\html\console" - RMDir "$INSTDIR\objs\nginx\html\live" - RMDir "$INSTDIR\objs\nginx\html" - RMDir "$INSTDIR\objs\nginx" - RMDir "$INSTDIR\objs" - RMDir "$INSTDIR\logo" - RMDir "$INSTDIR\conf" - RMDir "$INSTDIR" - - DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" - DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}" - DeleteRegKey HKLM "${PRODUCT_INSTALL_REGKEY}" - SetAutoClose true -SectionEnd \ No newline at end of file diff --git a/trunk/packaging/nsis/srs.pid b/trunk/packaging/nsis/srs.pid deleted file mode 100644 index e69de29bb..000000000 diff --git a/trunk/src/app/srs_app_circuit_breaker.cpp b/trunk/src/app/srs_app_circuit_breaker.cpp index 471c80deb..a65cc1e99 100644 --- a/trunk/src/app/srs_app_circuit_breaker.cpp +++ b/trunk/src/app/srs_app_circuit_breaker.cpp @@ -12,12 +12,10 @@ #include #include -#ifdef SRS_RTC #include extern SrsPps *_srs_pps_snack2; extern SrsPps *_srs_pps_snack3; extern SrsPps *_srs_pps_snack4; -#endif using namespace std; @@ -124,7 +122,6 @@ srs_error_t SrsCircuitBreaker::on_timer(srs_utime_t interval) float thread_percent = stat->percent * 100; string snk_desc; -#ifdef SRS_RTC static char buf[128]; if (_srs_pps_snack2->r10s()) { snprintf(buf, sizeof(buf), ", snk=%d,%d,%d", @@ -132,7 +129,6 @@ srs_error_t SrsCircuitBreaker::on_timer(srs_utime_t interval) ); 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", diff --git a/trunk/src/app/srs_app_gb28181.cpp b/trunk/src/app/srs_app_gb28181.cpp index bea249612..a3958d7be 100644 --- a/trunk/src/app/srs_app_gb28181.cpp +++ b/trunk/src/app/srs_app_gb28181.cpp @@ -1963,8 +1963,10 @@ srs_error_t SrsGbMuxer::write_h265_vps_sps_pps(uint32_t dts, uint32_t pts) return err; } + std::vector h265_pps; + h265_pps.push_back(h265_pps_); + std::string sh; - std::vector h265_pps = {h265_pps_}; if ((err = hevc_->mux_sequence_header(h265_vps_, h265_sps_, h265_pps, sh)) != srs_success) { return srs_error_wrap(err, "hevc mux sequence header"); } diff --git a/trunk/src/app/srs_app_hybrid.cpp b/trunk/src/app/srs_app_hybrid.cpp index 4d8b56003..5cd50d775 100644 --- a/trunk/src/app/srs_app_hybrid.cpp +++ b/trunk/src/app/srs_app_hybrid.cpp @@ -14,6 +14,8 @@ #include #include #include +#include +#include #include #include #include @@ -23,10 +25,6 @@ #include #include #include -#ifdef SRS_RTC -#include -#include -#endif #ifdef SRS_SRT #include #endif @@ -153,12 +151,10 @@ extern SrsConfig *_srs_config; extern SrsStageManager *_srs_stages; -#ifdef SRS_RTC extern SrsRtcBlackhole *_srs_blackhole; extern SrsResourceManager *_srs_rtc_manager; extern SrsDtlsCertificate *_srs_rtc_dtls_certificate; -#endif SrsPps *_srs_pps_aloss2 = NULL; @@ -568,7 +564,6 @@ 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(); @@ -581,7 +576,6 @@ 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, @@ -697,13 +691,11 @@ srs_error_t srs_global_initialize() _srs_srt_sources = new SrsSrtSourceManager(); #endif -#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 #ifdef SRS_RTSP _srs_rtsp_sources = new SrsRtspSourceManager(); _srs_rtsp_manager = new SrsResourceManager("RTSP", true); @@ -722,7 +714,6 @@ srs_error_t srs_global_initialize() _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(); @@ -734,7 +725,6 @@ srs_error_t srs_global_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(); @@ -794,7 +784,6 @@ srs_error_t srs_global_initialize() _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(); @@ -814,7 +803,6 @@ srs_error_t srs_global_initialize() _srs_pps_objs_rfua = new SrsPps(); _srs_pps_objs_rbuf = new SrsPps(); _srs_pps_objs_rothers = new SrsPps(); -#endif // Create global async worker for DVR. _srs_dvr_async = new SrsAsyncCallWorker(); diff --git a/trunk/src/app/srs_app_latest_version.cpp b/trunk/src/app/srs_app_latest_version.cpp index 24d027f05..21ae05daa 100644 --- a/trunk/src/app/srs_app_latest_version.cpp +++ b/trunk/src/app/srs_app_latest_version.cpp @@ -47,8 +47,6 @@ void srs_build_features(stringstream &ss) { if (SRS_OSX_BOOL) { ss << "&os=mac"; - } else if (SRS_CYGWIN64_BOOL) { - ss << "&os=windows"; } else { ss << "&os=linux"; } diff --git a/trunk/src/app/srs_app_rtc_conn.cpp b/trunk/src/app/srs_app_rtc_conn.cpp index 6703e136d..38ebed95b 100644 --- a/trunk/src/app/srs_app_rtc_conn.cpp +++ b/trunk/src/app/srs_app_rtc_conn.cpp @@ -1223,7 +1223,7 @@ srs_error_t SrsRtcPublishStream::initialize(SrsRequest *r, SrsRtcSourceDescripti #endif // Bridge to rtmp -#if defined(SRS_RTC) && defined(SRS_FFMPEG_FIT) +#if defined(SRS_FFMPEG_FIT) bool rtc_to_rtmp = _srs_config->get_rtc_to_rtmp(req_->vhost); if (rtc_to_rtmp) { if ((err = _srs_sources->fetch_or_create(r, _srs_hybrid->srs()->instance(), live_source)) != srs_success) { diff --git a/trunk/src/app/srs_app_rtc_network.cpp b/trunk/src/app/srs_app_rtc_network.cpp index 67324654f..5086fecd8 100644 --- a/trunk/src/app/srs_app_rtc_network.cpp +++ b/trunk/src/app/srs_app_rtc_network.cpp @@ -708,7 +708,7 @@ void SrsRtcTcpNetwork::dispose() #define SRS_RTC_TCP_PACKET_MAX 1500 -SrsRtcTcpConn::SrsRtcTcpConn() +void SrsRtcTcpConn::setup() { wrapper_ = NULL; owner_coroutine_ = NULL; @@ -720,8 +720,15 @@ SrsRtcTcpConn::SrsRtcTcpConn() skt_ = NULL; } -SrsRtcTcpConn::SrsRtcTcpConn(ISrsProtocolReadWriter *skt, std::string cip, int port) : SrsRtcTcpConn() +SrsRtcTcpConn::SrsRtcTcpConn() { + setup(); +} + +SrsRtcTcpConn::SrsRtcTcpConn(ISrsProtocolReadWriter *skt, std::string cip, int port) +{ + setup(); + ip_ = cip; port_ = port; skt_ = skt; diff --git a/trunk/src/app/srs_app_rtc_network.hpp b/trunk/src/app/srs_app_rtc_network.hpp index 6d799e704..12600ab5f 100644 --- a/trunk/src/app/srs_app_rtc_network.hpp +++ b/trunk/src/app/srs_app_rtc_network.hpp @@ -273,6 +273,9 @@ private: ISrsContextIdSetter *owner_cid_; SrsContextId cid_; +private: + void setup(); + public: SrsRtcTcpConn(); SrsRtcTcpConn(ISrsProtocolReadWriter *skt, std::string cip, int port); diff --git a/trunk/src/app/srs_app_rtc_source.cpp b/trunk/src/app/srs_app_rtc_source.cpp index 60cf9335b..7d3b7d5d9 100644 --- a/trunk/src/app/srs_app_rtc_source.cpp +++ b/trunk/src/app/srs_app_rtc_source.cpp @@ -2127,9 +2127,12 @@ srs_error_t SrsRtcFrameBuilder::do_packet_sequence_header_hevc(SrsRtpPacket *pkt { srs_error_t err = srs_success; - std::string sh; SrsUniquePtr hevc(new SrsRawHEVCStream()); - std::vector h265_pps = {string(pps->bytes, pps->size)}; + + std::vector h265_pps; + h265_pps.push_back(string(pps->bytes, pps->size)); + + std::string sh; if ((err = hevc->mux_sequence_header(string(vps->bytes, vps->size), string(sps->bytes, sps->size), h265_pps, sh)) != srs_success) { return srs_error_wrap(err, "mux sequence header"); } diff --git a/trunk/src/app/srs_app_rtmp_conn.cpp b/trunk/src/app/srs_app_rtmp_conn.cpp index fd1af9459..d244d7e49 100644 --- a/trunk/src/app/srs_app_rtmp_conn.cpp +++ b/trunk/src/app/srs_app_rtmp_conn.cpp @@ -1159,7 +1159,6 @@ srs_error_t SrsRtmpConn::acquire_publish(SrsSharedPtr source) } // Check whether RTC stream is busy. -#ifdef SRS_RTC SrsSharedPtr rtc; bool rtc_server_enabled = _srs_config->get_rtc_server_enabled(); bool rtc_enabled = _srs_config->get_rtc_enabled(req->vhost); @@ -1172,7 +1171,6 @@ srs_error_t SrsRtmpConn::acquire_publish(SrsSharedPtr source) return srs_error_new(ERROR_SYSTEM_STREAM_BUSY, "rtc stream %s busy", req->get_stream_url().c_str()); } } -#endif // Check whether SRT stream is busy. #ifdef SRS_SRT @@ -1206,7 +1204,7 @@ srs_error_t SrsRtmpConn::acquire_publish(SrsSharedPtr source) // TODO: FIXME: Need to convert RTMP to SRT. SrsCompositeBridge *bridge = new SrsCompositeBridge(); -#if defined(SRS_RTC) && defined(SRS_FFMPEG_FIT) +#if defined(SRS_FFMPEG_FIT) if (rtc.get() && _srs_config->get_rtc_from_rtmp(req->vhost)) { bridge->append(new SrsFrameToRtcBridge(rtc)); } diff --git a/trunk/src/app/srs_app_server.cpp b/trunk/src/app/srs_app_server.cpp index b81ec6e3f..bd528d297 100644 --- a/trunk/src/app/srs_app_server.cpp +++ b/trunk/src/app/srs_app_server.cpp @@ -27,6 +27,9 @@ using namespace std; #include #include #include +#include +#include +#include #include #include #include @@ -36,11 +39,6 @@ using namespace std; #include #include #include -#ifdef SRS_RTC -#include -#include -#include -#endif #ifdef SRS_GB28181 #include #endif @@ -514,7 +512,6 @@ srs_error_t SrsServer::initialize() string http_listen = _srs_config->get_http_stream_listen(); string https_listen = _srs_config->get_https_stream_listen(); -#ifdef SRS_RTC bool rtc = _srs_config->get_rtc_server_enabled(); bool rtc_tcp = _srs_config->get_rtc_server_tcp_enabled(); string rtc_listen = srs_int2str(_srs_config->get_rtc_server_tcp_listen()); @@ -527,7 +524,6 @@ srs_error_t SrsServer::initialize() srs_trace("WebRTC tcp=%s reuses https=%s server", rtc_listen.c_str(), https_listen.c_str()); reuse_rtc_over_server_ = true; } -#endif // If enabled and the listen is the same value, reuse port. bool api = _srs_config->get_http_api_enabled(); @@ -649,14 +645,12 @@ srs_error_t SrsServer::listen() } // Start WebRTC over TCP listener. -#ifdef SRS_RTC if (!reuse_rtc_over_server_ && _srs_config->get_rtc_server_tcp_enabled()) { webrtc_listener_->set_endpoint(srs_int2str(_srs_config->get_rtc_server_tcp_listen()))->set_label("WebRTC"); if ((err = webrtc_listener_->listen()) != srs_success) { return srs_error_wrap(err, "webrtc tcp listen"); } } -#endif #ifdef SRS_RTSP // Start RTSP listener. RTC is a critical dependency. @@ -870,11 +864,9 @@ srs_error_t SrsServer::start(SrsWaitGroup *wg) } #endif -#ifdef SRS_RTC if ((err = _srs_rtc_sources->initialize()) != srs_success) { return srs_error_wrap(err, "rtc sources"); } -#endif #ifdef SRS_RTSP if ((err = _srs_rtsp_sources->initialize()) != srs_success) { @@ -1208,13 +1200,11 @@ void SrsServer::resample_kbps() } #endif -#ifdef SRS_RTC SrsRtcTcpConn *tcp = dynamic_cast(c); if (tcp) { stat->kbps_add_delta(c->get_id().c_str(), tcp->delta()); continue; } -#endif // Impossible path, because we only create these connections above. srs_assert(false); @@ -1269,7 +1259,6 @@ srs_error_t SrsServer::do_on_tcp_client(ISrsListener *listener, srs_netfd_t &stf srs_netfd_t stfd2 = stfd; stfd = NULL; -#ifdef SRS_RTC // If reuse HTTP server with WebRTC TCP, peek to detect the client. if (reuse_rtc_over_server_ && (listener == http_listener_ || listener == https_listener_)) { SrsTcpConnection *skt = new SrsTcpConnection(stfd2); @@ -1299,7 +1288,6 @@ srs_error_t SrsServer::do_on_tcp_client(ISrsListener *listener, srs_netfd_t &stf resource = new SrsHttpxConn(this, io, http_server, ip, port, key, cert); } } -#endif // Create resource by normal listeners. if (!resource) { @@ -1317,10 +1305,8 @@ srs_error_t SrsServer::do_on_tcp_client(ISrsListener *listener, srs_netfd_t &stf string key = listener == https_listener_ ? _srs_config->get_https_stream_ssl_key() : ""; string cert = listener == https_listener_ ? _srs_config->get_https_stream_ssl_cert() : ""; resource = new SrsHttpxConn(this, new SrsTcpConnection(stfd2), http_server, ip, port, key, cert); -#ifdef SRS_RTC } else if (listener == webrtc_listener_) { resource = new SrsRtcTcpConn(new SrsTcpConnection(stfd2), ip, port); -#endif #ifdef SRS_RTSP } else if (listener == rtsp_listener_) { resource = new SrsRtspConnection(this, new SrsTcpConnection(stfd2), ip, port); @@ -1335,7 +1321,6 @@ srs_error_t SrsServer::do_on_tcp_client(ISrsListener *listener, srs_netfd_t &stf } } -#ifdef SRS_RTC // For RTC TCP connection, use resource executor to manage the resource. SrsRtcTcpConn *raw_conn = dynamic_cast(resource); if (raw_conn) { @@ -1348,7 +1333,6 @@ srs_error_t SrsServer::do_on_tcp_client(ISrsListener *listener, srs_netfd_t &stf } return err; } -#endif // Use connection manager to manage all the resources. srs_assert(resource); diff --git a/trunk/src/app/srs_app_srt_conn.cpp b/trunk/src/app/srs_app_srt_conn.cpp index d40926afb..15173f2fa 100644 --- a/trunk/src/app/srs_app_srt_conn.cpp +++ b/trunk/src/app/srs_app_srt_conn.cpp @@ -387,7 +387,6 @@ srs_error_t SrsMpegtsSrtConn::acquire_publish() // TODO: FIXME: the code below is repeat in srs_app_rtmp_conn.cpp, refactor it later, use function instead. // Check whether RTC stream is busy. -#ifdef SRS_RTC SrsSharedPtr rtc; bool rtc_server_enabled = _srs_config->get_rtc_server_enabled(); bool rtc_enabled = _srs_config->get_rtc_enabled(req_->vhost); @@ -401,14 +400,13 @@ srs_error_t SrsMpegtsSrtConn::acquire_publish() return srs_error_new(ERROR_SYSTEM_STREAM_BUSY, "rtc stream %s busy", req_->get_stream_url().c_str()); } } -#endif if (_srs_config->get_srt_to_rtmp(req_->vhost)) { // Bridge to RTMP and RTC streaming. SrsCompositeBridge *bridge = new SrsCompositeBridge(); bridge->append(new SrsFrameToRtmpBridge(live_source)); -#if defined(SRS_RTC) && defined(SRS_FFMPEG_FIT) +#if defined(SRS_FFMPEG_FIT) if (rtc.get() && _srs_config->get_rtc_from_rtmp(req_->vhost)) { bridge->append(new SrsFrameToRtcBridge(rtc)); } diff --git a/trunk/src/app/srs_app_stream_bridge.cpp b/trunk/src/app/srs_app_stream_bridge.cpp index c557fb31c..a100f55ea 100644 --- a/trunk/src/app/srs_app_stream_bridge.cpp +++ b/trunk/src/app/srs_app_stream_bridge.cpp @@ -65,7 +65,6 @@ srs_error_t SrsFrameToRtmpBridge::on_frame(SrsSharedPtrMessage *frame) return source_->on_frame(frame); } -#ifdef SRS_RTC SrsFrameToRtcBridge::SrsFrameToRtcBridge(SrsSharedPtr source) { source_ = source; @@ -135,8 +134,6 @@ srs_error_t SrsFrameToRtcBridge::on_rtp(SrsRtpPacket *pkt) return source_->on_rtp(pkt); } -#endif - #ifdef SRS_RTSP SrsFrameToRtspBridge::SrsFrameToRtspBridge(SrsSharedPtr source) { diff --git a/trunk/src/app/srs_app_stream_bridge.hpp b/trunk/src/app/srs_app_stream_bridge.hpp index 19e5c3e15..9f0589c4f 100644 --- a/trunk/src/app/srs_app_stream_bridge.hpp +++ b/trunk/src/app/srs_app_stream_bridge.hpp @@ -62,7 +62,6 @@ public: virtual srs_error_t on_frame(SrsSharedPtrMessage *frame); }; -#ifdef SRS_RTC // A bridge to covert AV frame to WebRTC stream. class SrsFrameToRtcBridge : public ISrsStreamBridge { @@ -84,7 +83,6 @@ public: virtual srs_error_t on_frame(SrsSharedPtrMessage *frame); srs_error_t on_rtp(SrsRtpPacket *pkt); }; -#endif #ifdef SRS_RTSP // A bridge to covert AV frame to RTSP stream. diff --git a/trunk/src/app/srs_app_uuid.cpp b/trunk/src/app/srs_app_uuid.cpp index 746f1422a..70538ccc2 100644 --- a/trunk/src/app/srs_app_uuid.cpp +++ b/trunk/src/app/srs_app_uuid.cpp @@ -6,10 +6,6 @@ #include -#if defined(SRS_CYGWIN64) -#define HAVE_LOFF_T -#endif - #include #include #include @@ -512,23 +508,14 @@ void uuid_unpack(const uuid_t in, struct uuid *uu); #define _SVID_SOURCE #endif -#ifdef _WIN32 -#define _WIN32_WINNT 0x0500 -#include -#define UUID MYUUID -#endif -#include -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_STDLIB_H -#include -#endif #include #include #include +#include +#include #include #include +#include #ifdef HAVE_SYS_TIME_H #include #endif @@ -617,29 +604,6 @@ static int flock(int fd, int op) #endif /* LOCK_EX */ -#ifdef _WIN32 -static void gettimeofday(struct timeval *tv, void *dummy) -{ - FILETIME ftime; - uint64_t n; - - GetSystemTimeAsFileTime(&ftime); - n = (((uint64_t)ftime.dwHighDateTime << 32) + (uint64_t)ftime.dwLowDateTime); - if (n) { - n /= 10; - n -= ((369 * 365 + 89) * (uint64_t)86400) * 1000000; - } - - tv->tv_sec = n / 1000000; - tv->tv_usec = n % 1000000; -} - -static int getuid(void) -{ - return 1; -} -#endif - /* * Get the ethernet hardware address, if we can find it... * diff --git a/trunk/src/core/srs_core_autofree.hpp b/trunk/src/core/srs_core_autofree.hpp index b2b23065b..1b70d8b7c 100644 --- a/trunk/src/core/srs_core_autofree.hpp +++ b/trunk/src/core/srs_core_autofree.hpp @@ -65,21 +65,21 @@ public: private: // Copy the unique ptr. - SrsUniquePtr(const SrsUniquePtr &) = delete; + SrsUniquePtr(const SrsUniquePtr &); // The assign operator. - SrsUniquePtr &operator=(const SrsUniquePtr &) = delete; + SrsUniquePtr &operator=(const SrsUniquePtr &); private: // Overload the * operator. - T &operator*() = delete; + T &operator*(); // Overload the bool operator. - operator bool() const = delete; + operator bool() const; #if __cplusplus >= 201103L // C++11 private: // The move constructor. - SrsUniquePtr(SrsUniquePtr &&) = delete; + SrsUniquePtr(SrsUniquePtr &&); // The move assign operator. - SrsUniquePtr &operator=(SrsUniquePtr &&) = delete; + SrsUniquePtr &operator=(SrsUniquePtr &&); #endif }; @@ -127,21 +127,21 @@ public: private: // Copy the unique ptr. - SrsUniquePtr(const SrsUniquePtr &) = delete; + SrsUniquePtr(const SrsUniquePtr &); // The assign operator. - SrsUniquePtr &operator=(const SrsUniquePtr &) = delete; + SrsUniquePtr &operator=(const SrsUniquePtr &); private: // Overload the * operator. - T &operator*() = delete; + T &operator*(); // Overload the bool operator. - operator bool() const = delete; + operator bool() const; #if __cplusplus >= 201103L // C++11 private: // The move constructor. - SrsUniquePtr(SrsUniquePtr &&) = delete; + SrsUniquePtr(SrsUniquePtr &&); // The move assign operator. - SrsUniquePtr &operator=(SrsUniquePtr &&) = delete; + SrsUniquePtr &operator=(SrsUniquePtr &&); #endif }; diff --git a/trunk/src/core/srs_core_platform.hpp b/trunk/src/core/srs_core_platform.hpp index 0eb1e6a55..640142852 100644 --- a/trunk/src/core/srs_core_platform.hpp +++ b/trunk/src/core/srs_core_platform.hpp @@ -19,14 +19,12 @@ #endif // For RTC/FFMPEG build. -#if defined(SRS_RTC) && !defined(__STDC_CONSTANT_MACROS) +#if !defined(__STDC_CONSTANT_MACROS) #define __STDC_CONSTANT_MACROS #endif // For srs-librtmp, @see https://github.com/ossrs/srs/issues/213 -#ifndef _WIN32 #include -#endif #include #include diff --git a/trunk/src/core/srs_core_time.hpp b/trunk/src/core/srs_core_time.hpp index 56313c079..f7da01878 100644 --- a/trunk/src/core/srs_core_time.hpp +++ b/trunk/src/core/srs_core_time.hpp @@ -8,13 +8,8 @@ #define SRS_CORE_TIME_HPP // Time and duration unit, in us. -#if defined(_WIN32) && !defined(__MINGW32__) && (!defined(_MSC_VER) || _MSC_VER < 1600) && !defined(__WINE__) -#include -typedef __int64 srs_utime_t; -#else #include typedef int64_t srs_utime_t; -#endif // The time unit in ms, for example 100 * SRS_UTIME_MILLISECONDS means 100ms. #define SRS_UTIME_MILLISECONDS 1000 diff --git a/trunk/src/core/srs_core_version7.hpp b/trunk/src/core/srs_core_version7.hpp index 52c2ba9d2..36992b251 100644 --- a/trunk/src/core/srs_core_version7.hpp +++ b/trunk/src/core/srs_core_version7.hpp @@ -9,6 +9,6 @@ #define VERSION_MAJOR 7 #define VERSION_MINOR 0 -#define VERSION_REVISION 59 +#define VERSION_REVISION 60 #endif \ No newline at end of file diff --git a/trunk/src/kernel/srs_kernel_file.cpp b/trunk/src/kernel/srs_kernel_file.cpp index 67a0ed533..fe91c9176 100644 --- a/trunk/src/kernel/srs_kernel_file.cpp +++ b/trunk/src/kernel/srs_kernel_file.cpp @@ -7,10 +7,8 @@ #include // for srs-librtmp, @see https://github.com/ossrs/srs/issues/213 -#ifndef _WIN32 #include #include -#endif #include #include @@ -282,11 +280,7 @@ srs_error_t SrsFileReader::read(void *buf, size_t count, ssize_t *pnread) ssize_t nread; // TODO: FIXME: use st_read. -#ifdef _WIN32 - if ((nread = _read(fd, buf, (unsigned int)count)) < 0) { -#else if ((nread = _srs_read_fn(fd, buf, count)) < 0) { -#endif return srs_error_new(ERROR_SYSTEM_FILE_READ, "read from file %s failed", path.c_str()); } diff --git a/trunk/src/kernel/srs_kernel_file.hpp b/trunk/src/kernel/srs_kernel_file.hpp index e0e2f8524..83b26a6cc 100644 --- a/trunk/src/kernel/srs_kernel_file.hpp +++ b/trunk/src/kernel/srs_kernel_file.hpp @@ -11,12 +11,11 @@ #include +#include #include // for srs-librtmp, @see https://github.com/ossrs/srs/issues/213 -#ifndef _WIN32 #include -#endif class SrsFileReader; diff --git a/trunk/src/kernel/srs_kernel_ts.cpp b/trunk/src/kernel/srs_kernel_ts.cpp index e4298f3cf..1a1ec1a09 100644 --- a/trunk/src/kernel/srs_kernel_ts.cpp +++ b/trunk/src/kernel/srs_kernel_ts.cpp @@ -7,9 +7,7 @@ #include // for srs-librtmp, @see https://github.com/ossrs/srs/issues/213 -#ifndef _WIN32 #include -#endif #include #include diff --git a/trunk/src/kernel/srs_kernel_utility.cpp b/trunk/src/kernel/srs_kernel_utility.cpp index a3c98e70f..3d294ec60 100644 --- a/trunk/src/kernel/srs_kernel_utility.cpp +++ b/trunk/src/kernel/srs_kernel_utility.cpp @@ -6,18 +6,16 @@ #include -#ifndef _WIN32 #include -#include -#include -#include -#endif - #include +#include #include #include #include +#include #include +#include +#include #include #include @@ -593,12 +591,8 @@ int srs_do_create_dir_recursively(string dir) } // create curren dir. -#ifdef _WIN32 - if (::_mkdir(dir.c_str()) < 0) { -#else mode_t mode = S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IXOTH; if (::mkdir(dir.c_str(), mode) < 0) { -#endif if (errno == EEXIST) { return ERROR_SYSTEM_DIR_EXISTS; } diff --git a/trunk/src/main/srs_main_server.cpp b/trunk/src/main/srs_main_server.cpp index 4f42f4467..8e4ace08b 100644 --- a/trunk/src/main/srs_main_server.cpp +++ b/trunk/src/main/srs_main_server.cpp @@ -43,10 +43,8 @@ using namespace std; #include #include -#ifdef SRS_RTC #include #include -#endif #ifdef SRS_SRT #include @@ -467,9 +465,7 @@ srs_error_t run_hybrid_server() _srs_hybrid->register_server(new SrsSrtServerAdapter()); #endif -#ifdef SRS_RTC _srs_hybrid->register_server(new SrsRtcServerAdapter()); -#endif // Do some system initialize. if ((err = _srs_hybrid->initialize()) != srs_success) { diff --git a/trunk/src/protocol/srs_protocol_http_stack.hpp b/trunk/src/protocol/srs_protocol_http_stack.hpp index fddd340b4..1b31aecb3 100644 --- a/trunk/src/protocol/srs_protocol_http_stack.hpp +++ b/trunk/src/protocol/srs_protocol_http_stack.hpp @@ -744,20 +744,7 @@ extern "C" { #define HTTP_PARSER_VERSION_PATCH 2 #include -#if defined(_WIN32) && !defined(__MINGW32__) && \ - (!defined(_MSC_VER) || _MSC_VER < 1600) && !defined(__WINE__) -#include -typedef __int8 int8_t; -typedef unsigned __int8 uint8_t; -typedef __int16 int16_t; -typedef unsigned __int16 uint16_t; -typedef __int32 int32_t; -typedef unsigned __int32 uint32_t; -typedef __int64 int64_t; -typedef unsigned __int64 uint64_t; -#else #include -#endif /* Compile with -DHTTP_PARSER_STRICT=0 to make less checks, but run * faster diff --git a/trunk/src/protocol/srs_protocol_rtmp_stack.cpp b/trunk/src/protocol/srs_protocol_rtmp_stack.cpp index 7249eb0ea..899490b39 100644 --- a/trunk/src/protocol/srs_protocol_rtmp_stack.cpp +++ b/trunk/src/protocol/srs_protocol_rtmp_stack.cpp @@ -16,9 +16,7 @@ #include // for srs-librtmp, @see https://github.com/ossrs/srs/issues/213 -#ifndef _WIN32 #include -#endif #include using namespace std; diff --git a/trunk/src/protocol/srs_protocol_utility.cpp b/trunk/src/protocol/srs_protocol_utility.cpp index 567fcd969..5fdb65999 100644 --- a/trunk/src/protocol/srs_protocol_utility.cpp +++ b/trunk/src/protocol/srs_protocol_utility.cpp @@ -6,9 +6,7 @@ #include -#ifndef _WIN32 #include -#endif #include #include @@ -368,12 +366,8 @@ srs_error_t srs_write_large_iovs(ISrsProtocolReadWriter *skt, iovec *iovs, int s srs_error_t err = srs_success; // the limits of writev iovs. -#ifndef _WIN32 // for linux, generally it's 1024. static int limits = (int)sysconf(_SC_IOV_MAX); -#else - static int limits = 1024; -#endif // send in a time. if (size <= limits) { diff --git a/trunk/src/protocol/srs_protocol_utility.hpp b/trunk/src/protocol/srs_protocol_utility.hpp index dfa3149bd..6253fa166 100644 --- a/trunk/src/protocol/srs_protocol_utility.hpp +++ b/trunk/src/protocol/srs_protocol_utility.hpp @@ -9,9 +9,7 @@ #include -#ifndef _WIN32 #include -#endif #include #include diff --git a/trunk/src/utest/srs_utest_protocol.cpp b/trunk/src/utest/srs_utest_protocol.cpp index bf8d59442..335e608c1 100644 --- a/trunk/src/utest/srs_utest_protocol.cpp +++ b/trunk/src/utest/srs_utest_protocol.cpp @@ -21,9 +21,7 @@ using namespace std; #include #include -#ifdef SRS_RTC #include -#endif MockEmptyIO::MockEmptyIO() { @@ -5517,7 +5515,6 @@ VOID TEST(ProtocolRTSPTest, RTSPTcpOnlyTransport) } } -#ifdef SRS_RTC // Test SDP advertisement of TCP-only transport VOID TEST(ProtocolRTSPTest, RTSPSdpTcpOnlyAdvertisement) { @@ -5567,7 +5564,6 @@ VOID TEST(ProtocolRTSPTest, RTSPSdpTcpOnlyAdvertisement) srs_trace("Generated TCP-only SDP:\n%s", sdp_content.c_str()); } } -#endif // Invalid RTSP Request VOID TEST(ProtocolRTSPTest, RTSPInvalidRequest)