Fixing UpdateLevel function in AEC.
From an earlier CL, we start to feed UpdateLevel() with power instead of energy. I found that UpdateLevel() is still taking the input as energy and normalize it. This CL fixes this.
The earlier CL is
https://codereview.webrtc.org/1542573002/
BUG=
Review URL: https://codereview.webrtc.org/1810773003
Cr-Commit-Position: refs/heads/master@{#12084}
diff --git a/webrtc/modules/audio_processing/aec/aec_core.cc b/webrtc/modules/audio_processing/aec/aec_core.cc
index 1b5f03f..4de7812 100644
--- a/webrtc/modules/audio_processing/aec/aec_core.cc
+++ b/webrtc/modules/audio_processing/aec/aec_core.cc
@@ -568,12 +568,12 @@
return energy / num_samples;
}
-static void UpdateLevel(PowerLevel* level, float energy) {
- level->sfrsum += energy;
+static void UpdateLevel(PowerLevel* level, float power) {
+ level->sfrsum += power;
level->sfrcounter++;
if (level->sfrcounter > subCountLen) {
- level->framelevel = level->sfrsum / (subCountLen * PART_LEN);
+ level->framelevel = level->sfrsum / subCountLen;
level->sfrsum = 0;
level->sfrcounter = 0;
if (level->framelevel > 0) {
@@ -600,11 +600,7 @@
const float actThresholdClean = 40.0f;
const float safety = 0.99995f;
- // To make noisePower consistent with the legacy code, a factor of
- // 2.0f / PART_LEN2 is applied to noisyPower, since the legacy code uses
- // the energy of a frame as the audio levels, while the new code uses a
- // a per-sample energy (i.e., power).
- const float noisyPower = 300000.0f * 2.0f / PART_LEN2;
+ const float noisyPower = 300000.0f;
float actThreshold;
float echo, suppressedEcho;