From 4ba485002c5799cd68992edc9bb9b048a6623b23 Mon Sep 17 00:00:00 2001 From: Pieere Pi Date: Wed, 3 Mar 2021 20:40:51 +0800 Subject: [PATCH] Fix #2106, #2011, RTMP/AAC transcode to Opus bug. 4.0.81 --- README.md | 4 ++++ trunk/src/app/srs_app_rtc_codec.cpp | 9 +++++---- trunk/src/core/srs_core_version4.hpp | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e03c528af..58ded9b82 100755 --- a/README.md +++ b/README.md @@ -157,6 +157,8 @@ For previous versions, please read: ## V4 changes +* v4.0, 2021-03-03, Fix [#2106][bug #2106], [#2011][bug #2011], RTMP/AAC transcode to Opus bug. 4.0.81 +* v4.0, 2021-03-02, Refine build script for FFmpeg and SRTP. 4.0.80 * v4.0, 2021-03-02, Upgrade libsrtp from 2.0.0 to 2.3.0, with source code. 4.0.79 * v4.0, 2021-03-01, Upgrade openssl from 1.1.0e to 1.1.1b, with source code. 4.0.78 * v4.0, 2021-03-01, Enable Object Cache and Zero Copy Nack by default. 4.0.77 @@ -1823,6 +1825,8 @@ Winlin [bug #1657-2]: https://github.com/ossrs/srs/issues/1657#issuecomment-722904004 [bug #1657-3]: https://github.com/ossrs/srs/issues/1657#issuecomment-722971676 [bug #1998]: https://github.com/ossrs/srs/issues/1998 +[bug #2106]: https://github.com/ossrs/srs/issues/2106 +[bug #2011]: https://github.com/ossrs/srs/issues/2011 [bug #zzzzzzzzzzzzz]: https://github.com/ossrs/srs/issues/zzzzzzzzzzzzz [exo #828]: https://github.com/google/ExoPlayer/pull/828 diff --git a/trunk/src/app/srs_app_rtc_codec.cpp b/trunk/src/app/srs_app_rtc_codec.cpp index b3db983ef..7194f9605 100644 --- a/trunk/src/app/srs_app_rtc_codec.cpp +++ b/trunk/src/app/srs_app_rtc_codec.cpp @@ -130,10 +130,11 @@ srs_error_t SrsAudioDecoder::decode(SrsSample *pkt, char *buf, int &size) return srs_error_new(ERROR_RTC_RTP_MUXER, "Failed to calculate data size"); } - for (int i = 0; i < frame_->nb_samples; i++) { - if (size + pcm_size * codec_ctx_->channels <= max) { - memcpy(buf + size,frame_->data[0] + pcm_size*codec_ctx_->channels * i, pcm_size * codec_ctx_->channels); - size += pcm_size * codec_ctx_->channels; + // @see https://github.com/ossrs/srs/pull/2011/files + for (int i = 0; i < codec_ctx_->channels; i++) { + if (size + pcm_size * frame_->nb_samples <= max) { + memcpy(buf + size,frame_->data[i],pcm_size * frame_->nb_samples); + size += pcm_size * frame_->nb_samples; } } } diff --git a/trunk/src/core/srs_core_version4.hpp b/trunk/src/core/srs_core_version4.hpp index 6b893b0e7..63540429b 100644 --- a/trunk/src/core/srs_core_version4.hpp +++ b/trunk/src/core/srs_core_version4.hpp @@ -24,6 +24,6 @@ #ifndef SRS_CORE_VERSION4_HPP #define SRS_CORE_VERSION4_HPP -#define SRS_VERSION4_REVISION 79 +#define SRS_VERSION4_REVISION 81 #endif