Skip to content
This repository was archived by the owner on Oct 25, 2024. It is now read-only.

Commit 262cbaa

Browse files
peahCommit bot
authored andcommitted
Merge of the AEC3 Tuning changes.
This CL is a merge of 103ac7e into M59. This CL adds tuning to AEC3 for the purpose of reducing the impact of gain changes in the analog microphone gain. NOTRY=true NOPRESUBMIT=true BUG=chromium:710818, webrtc:6018 Review-Url: https://codereview.webrtc.org/2811283003 Cr-Commit-Position: refs/heads/master@{#17673} (cherry picked from commit 103ac7e) Review-Url: https://codereview.webrtc.org/2833643003 Cr-Commit-Position: refs/branch-heads/59@{#3} Cr-Branched-From: 10d095d-refs/heads/master@{#17657}
1 parent 21721bc commit 262cbaa

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

webrtc/modules/audio_processing/aec3/aec_state.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ rtc::Optional<size_t> EstimateFilterDelay(
7272
}
7373

7474
constexpr int kEchoPathChangeCounterInitial = kNumBlocksPerSecond / 5;
75-
constexpr int kEchoPathChangeCounterMax = 3 * kNumBlocksPerSecond;
75+
constexpr int kEchoPathChangeCounterMax = 2 * kNumBlocksPerSecond;
7676

7777
} // namespace
7878

@@ -90,17 +90,19 @@ void AecState::HandleEchoPathChange(
9090
if (echo_path_variability.AudioPathChanged()) {
9191
blocks_since_last_saturation_ = 0;
9292
active_render_blocks_ = 0;
93-
echo_path_change_counter_ = kEchoPathChangeCounterMax;
9493
usable_linear_estimate_ = false;
9594
echo_leakage_detected_ = false;
9695
capture_signal_saturation_ = false;
9796
echo_saturation_ = false;
98-
headset_detected_ = false;
9997
previous_max_sample_ = 0.f;
10098

10199
if (echo_path_variability.delay_change) {
102100
force_zero_gain_counter_ = 0;
103101
force_zero_gain_ = true;
102+
echo_path_change_counter_ = kEchoPathChangeCounterMax;
103+
}
104+
if (echo_path_variability.gain_change) {
105+
echo_path_change_counter_ = kEchoPathChangeCounterInitial;
104106
}
105107
}
106108
}

webrtc/modules/audio_processing/audio_processing_impl.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#include "webrtc/modules/audio_processing/audio_processing_impl.h"
1212

13+
#include <math.h>
1314
#include <algorithm>
1415

1516
#include "webrtc/base/checks.h"
@@ -1147,7 +1148,7 @@ int AudioProcessingImpl::ProcessCaptureStreamLocked() {
11471148
if (private_submodules_->echo_canceller3) {
11481149
const int new_agc_level = gain_control()->stream_analog_level();
11491150
capture_.echo_path_gain_change =
1150-
(capture_.previous_agc_level != new_agc_level);
1151+
abs(capture_.previous_agc_level - new_agc_level) > 5;
11511152
capture_.previous_agc_level = new_agc_level;
11521153
private_submodules_->echo_canceller3->AnalyzeCapture(capture_buffer);
11531154
}

0 commit comments

Comments
 (0)