From e7b629cd399dfc5c4399d1cde87cf6c96e0046bd Mon Sep 17 00:00:00 2001 From: chundonglinlin Date: Sat, 4 Nov 2023 16:21:44 +0800 Subject: [PATCH] RTC: Refine FFmpeg opus audio noisy issue. v5.0.197 v6.0.97 (#3852) ### Description When converting between AAC and Opus formats (aac2opus or opus2aac), the `av_frame_get_buffer` API is frequently called. ### Objective The goal is to optimize the code logic and reduce the frequent allocation and deallocation of memory. In the case of aac2opus, av_frame_get_buffer is still frequently called. In the case of opus2aac, the goal is to avoid calling av_frame_get_buffer and reduce memory allocations. ### Additional Note Before calling the `av_audio_fifo_read` API, use `av_frame_make_writable` to check if the frame is writable. If it is not writable, create a new frame. --------- Co-authored-by: john --- .github/workflows/test.yml | 3 ++- trunk/auto/options.sh | 3 +-- trunk/doc/CHANGELOG.md | 2 ++ trunk/research/players/js/srs.page.js | 1 - trunk/research/players/srs_player.html | 6 +++--- trunk/research/players/whep.html | 6 +++--- trunk/research/players/whip.html | 6 +++--- trunk/src/app/srs_app_rtc_codec.cpp | 20 +++++++++++--------- trunk/src/core/srs_core_version5.hpp | 2 +- trunk/src/core/srs_core_version6.hpp | 2 +- 10 files changed, 27 insertions(+), 24 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 440cf00059..6ea5e3c1f4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -198,7 +198,8 @@ jobs: - name: Run SRS regression-test run: | docker run --rm srs:test bash -c './objs/srs -c conf/regression-test.conf && \ - cd 3rdparty/srs-bench && ./objs/srs_test -test.v && ./objs/srs_gb28181_test -test.v' + cd 3rdparty/srs-bench && (./objs/srs_test -test.v || (cat ../../objs/srs.log && exit 1)) && \ + ./objs/srs_gb28181_test -test.v' runs-on: ubuntu-20.04 coverage: diff --git a/trunk/auto/options.sh b/trunk/auto/options.sh index 333233a066..40d41ba244 100755 --- a/trunk/auto/options.sh +++ b/trunk/auto/options.sh @@ -451,8 +451,7 @@ function parse_user_option() { --ffmpeg-tool) SRS_FFMPEG_TOOL=$(switch2value $value) ;; # use cache for build. - --build-cache) SRS_BUILD_CACHE=YES ;; - --without-build-cache) SRS_BUILD_CACHE=NO ;; + --build-cache) SRS_BUILD_CACHE=$(switch2value $value) ;; *) echo "$0: error: invalid option \"$option\"" diff --git a/trunk/doc/CHANGELOG.md b/trunk/doc/CHANGELOG.md index 9a96b03738..551a7b0a83 100644 --- a/trunk/doc/CHANGELOG.md +++ b/trunk/doc/CHANGELOG.md @@ -7,6 +7,7 @@ The changelog for SRS. ## SRS 6.0 Changelog +* v6.0, 2023-11-04, Merge [#3852](https://github.com/ossrs/srs/pull/3852): RTC: Refine FFmpeg opus audio noisy issue. v6.0.97 (#3852) * v6.0, 2023-11-01, Merge [#3858](https://github.com/ossrs/srs/pull/3858): Support build without cache to test if actions fail. v6.0.96 (#3858) * v6.0, 2023-10-25, Merge [#3845](https://github.com/ossrs/srs/pull/3845): RTC: Fix FFmpeg opus audio noisy issue. v6.0.95 (#3845) * v6.0, 2023-10-21, Merge [#3847](https://github.com/ossrs/srs/pull/3847): WebRTC: TCP transport should use read_fully instead of read. v6.0.94 (#3847) @@ -108,6 +109,7 @@ The changelog for SRS. ## SRS 5.0 Changelog +* v5.0, 2023-11-04, Merge [#3852](https://github.com/ossrs/srs/pull/3852): RTC: Refine FFmpeg opus audio noisy issue. v5.0.197 (#3852) * v5.0, 2023-11-01, Merge [#3858](https://github.com/ossrs/srs/pull/3858): Support build without cache to test if actions fail. v5.0.196 (#3858) * v5.0, 2023-10-25, Merge [#3845](https://github.com/ossrs/srs/pull/3845): RTC: Fix FFmpeg opus audio noisy issue. v5.0.195 (#3845) * v5.0, 2023-10-21, Merge [#3847](https://github.com/ossrs/srs/pull/3847): WebRTC: TCP transport should use read_fully instead of read. v5.0.194 (#3847) diff --git a/trunk/research/players/js/srs.page.js b/trunk/research/players/js/srs.page.js index ff4415445b..520491e48d 100755 --- a/trunk/research/players/js/srs.page.js +++ b/trunk/research/players/js/srs.page.js @@ -13,7 +13,6 @@ function srs_get_player_height() { return srs_get_player_width() * 9 / 19; } * update the navigator, add same query string. */ function update_nav() { - $("#srs_index").attr("href", "index.html" + window.location.search); $("#nav_srs_player").attr("href", "srs_player.html" + window.location.search); $("#nav_rtc_player").attr("href", "rtc_player.html" + window.location.search); $("#nav_rtc_publisher").attr("href", "rtc_publisher.html" + window.location.search); diff --git a/trunk/research/players/srs_player.html b/trunk/research/players/srs_player.html index 16fb1b288b..74579491e9 100755 --- a/trunk/research/players/srs_player.html +++ b/trunk/research/players/srs_player.html @@ -15,7 +15,7 @@