Fixing the bounds for the max and min erle in the erle instantaneous estimation.

Bug: webrtc:12283
Change-Id: I534a5da30e575f9b100046fff31a84774afbf67f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/196654
Commit-Queue: Jesus de Vicente Pena <devicentepena@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32834}
This commit is contained in:
Jesús de Vicente Peña 2020-12-15 14:24:31 +01:00 committed by Commit Bot
parent a13b47ffc0
commit 16dd6b0ce4

View File

@ -162,17 +162,12 @@ void FullBandErleEstimator::ErleInstantaneous::Dump(
void FullBandErleEstimator::ErleInstantaneous::UpdateMaxMin() {
RTC_DCHECK(erle_log2_);
if (erle_log2_.value() > max_erle_log2_) {
max_erle_log2_ = erle_log2_.value();
} else {
max_erle_log2_ -= 0.0004; // Forget factor, approx 1dB every 3 sec.
}
if (erle_log2_.value() < min_erle_log2_) {
min_erle_log2_ = erle_log2_.value();
} else {
min_erle_log2_ += 0.0004; // Forget factor, approx 1dB every 3 sec.
}
// Adding the forgetting factors for the maximum and minimum and capping the
// result to the incoming value.
max_erle_log2_ -= 0.0004f; // Forget factor, approx 1dB every 3 sec.
max_erle_log2_ = std::max(max_erle_log2_, erle_log2_.value());
min_erle_log2_ += 0.0004f; // Forget factor, approx 1dB every 3 sec.
min_erle_log2_ = std::min(min_erle_log2_, erle_log2_.value());
}
void FullBandErleEstimator::ErleInstantaneous::UpdateQualityEstimate() {