NetEq: Change NetEq's ramp-up behavior after expansions
NetEq tapers down the audio produced through loss concealment when the
expansion has been going on for some time. When the audio packets starts
coming in again, there is a ramp-up that happens. This ramp-up could
before this change extend over more than one 10 ms block, which made
keeping track of the scaling factor necessary. With this change, we make
this ramp-up quicker in the rare cases when it lasted more than 10 ms,
so that it always ramps up to 100% within one block. This way, we can
remove the mute_factor_array.
This change breaks bit-exactness, but careful listening could not reveal
an audible difference.
This change is a part of a larger refactoring of NetEq's PLC code.
Bug: webrtc:9180
Change-Id: I4c513ce3ed8d66f9beec2abfb1f0c7ffaac7a21e
Reviewed-on: https://webrtc-review.googlesource.com/77180
Commit-Queue: Henrik Lundin <henrik.lundin@webrtc.org>
Reviewed-by: Minyue Li <minyue@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#23342}
diff --git a/modules/audio_coding/neteq/neteq_impl.cc b/modules/audio_coding/neteq/neteq_impl.cc
index 80bfdaf..688162b 100644
--- a/modules/audio_coding/neteq/neteq_impl.cc
+++ b/modules/audio_coding/neteq/neteq_impl.cc
@@ -1536,9 +1536,8 @@
void NetEqImpl::DoNormal(const int16_t* decoded_buffer, size_t decoded_length,
AudioDecoder::SpeechType speech_type, bool play_dtmf) {
assert(normal_.get());
- assert(mute_factor_array_.get());
normal_->Process(decoded_buffer, decoded_length, last_mode_,
- mute_factor_array_.get(), algorithm_buffer_.get());
+ algorithm_buffer_.get());
if (decoded_length != 0) {
last_mode_ = kModeNormal;
}
@@ -1558,10 +1557,8 @@
void NetEqImpl::DoMerge(int16_t* decoded_buffer, size_t decoded_length,
AudioDecoder::SpeechType speech_type, bool play_dtmf) {
- assert(mute_factor_array_.get());
assert(merge_.get());
size_t new_length = merge_->Process(decoded_buffer, decoded_length,
- mute_factor_array_.get(),
algorithm_buffer_.get());
// Correction can be negative.
int expand_length_correction =
@@ -1803,9 +1800,8 @@
void NetEqImpl::DoCodecInternalCng(const int16_t* decoded_buffer,
size_t decoded_length) {
RTC_DCHECK(normal_.get());
- RTC_DCHECK(mute_factor_array_.get());
normal_->Process(decoded_buffer, decoded_length, last_mode_,
- mute_factor_array_.get(), algorithm_buffer_.get());
+ algorithm_buffer_.get());
last_mode_ = kModeCodecInternalCng;
expand_->Reset();
}
@@ -2065,12 +2061,6 @@
last_mode_ = kModeNormal;
- // Create a new array of mute factors and set all to 1.
- mute_factor_array_.reset(new int16_t[channels]);
- for (size_t i = 0; i < channels; ++i) {
- mute_factor_array_[i] = 16384; // 1.0 in Q14.
- }
-
ComfortNoiseDecoder* cng_decoder = decoder_database_->GetActiveCngDecoder();
if (cng_decoder)
cng_decoder->Reset();