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

Commit 39f9d86

Browse files
authored
Revert "delay estimator: Look for early reverberation" (#173)
This reverts commit 8783c67. Reason to revert: This change breaks MSVC build.
1 parent 4da180d commit 39f9d86

14 files changed

+393
-955
lines changed

api/audio/echo_canceller3_config.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ struct RTC_EXPORT EchoCanceller3Config {
5959
};
6060
AlignmentMixing render_alignment_mixing = {false, true, 10000.f, true};
6161
AlignmentMixing capture_alignment_mixing = {false, true, 10000.f, false};
62-
bool detect_pre_echo = false;
6362
} delay;
6463

6564
struct Filter {

api/audio/echo_canceller3_config_json.cc

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ void Aec3ConfigFromJsonString(absl::string_view json_string,
220220
&cfg.delay.render_alignment_mixing);
221221
ReadParam(section, "capture_alignment_mixing",
222222
&cfg.delay.capture_alignment_mixing);
223-
ReadParam(section, "detect_pre_echo", &cfg.delay.detect_pre_echo);
224223
}
225224

226225
if (rtc::GetValueFromJsonObject(aec3_root, "filter", &section)) {
@@ -506,9 +505,7 @@ std::string Aec3ConfigToJsonString(const EchoCanceller3Config& config) {
506505
<< (config.delay.capture_alignment_mixing.prefer_first_two_channels
507506
? "true"
508507
: "false");
509-
ost << "},";
510-
ost << "\"detect_pre_echo\": "
511-
<< (config.delay.detect_pre_echo ? "true" : "false");
508+
ost << "}";
512509
ost << "},";
513510

514511
ost << "\"filter\": {";

modules/audio_processing/aec3/BUILD.gn

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,6 @@ rtc_source_set("matched_filter") {
230230
"../../../api:array_view",
231231
"../../../rtc_base/system:arch",
232232
]
233-
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
234233
}
235234

236235
rtc_source_set("vector_math") {

modules/audio_processing/aec3/echo_canceller3.cc

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -378,14 +378,6 @@ EchoCanceller3Config AdjustConfig(const EchoCanceller3Config& config) {
378378
false;
379379
}
380380

381-
if (field_trial::IsEnabled("WebRTC-Aec3DelayEstimatorDetectPreEcho")) {
382-
adjusted_cfg.delay.detect_pre_echo = true;
383-
}
384-
385-
if (field_trial::IsDisabled("WebRTC-Aec3DelayEstimatorDetectPreEcho")) {
386-
adjusted_cfg.delay.detect_pre_echo = false;
387-
}
388-
389381
if (field_trial::IsEnabled("WebRTC-Aec3SensitiveDominantNearendActivation")) {
390382
adjusted_cfg.suppressor.dominant_nearend_detection.enr_threshold = 0.5f;
391383
} else if (field_trial::IsEnabled(

modules/audio_processing/aec3/echo_path_delay_estimator.cc

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,10 @@ EchoPathDelayEstimator::EchoPathDelayEstimator(
4343
: config.render_levels.poor_excitation_render_limit,
4444
config.delay.delay_estimate_smoothing,
4545
config.delay.delay_estimate_smoothing_delay_found,
46-
config.delay.delay_candidate_detection_threshold,
47-
config.delay.detect_pre_echo),
46+
config.delay.delay_candidate_detection_threshold),
4847
matched_filter_lag_aggregator_(data_dumper_,
4948
matched_filter_.GetMaxFilterLag(),
50-
config.delay) {
49+
config.delay.delay_selection_thresholds) {
5150
RTC_DCHECK(data_dumper);
5251
RTC_DCHECK(down_sampling_factor_ > 0);
5352
}
@@ -76,14 +75,13 @@ absl::optional<DelayEstimate> EchoPathDelayEstimator::EstimateDelay(
7675

7776
absl::optional<DelayEstimate> aggregated_matched_filter_lag =
7877
matched_filter_lag_aggregator_.Aggregate(
79-
matched_filter_.GetBestLagEstimate());
78+
matched_filter_.GetLagEstimates());
8079

8180
// Run clockdrift detection.
8281
if (aggregated_matched_filter_lag &&
8382
(*aggregated_matched_filter_lag).quality ==
8483
DelayEstimate::Quality::kRefined)
85-
clockdrift_detector_.Update(
86-
matched_filter_lag_aggregator_.GetDelayAtHighestPeak());
84+
clockdrift_detector_.Update((*aggregated_matched_filter_lag).delay);
8785

8886
// TODO(peah): Move this logging outside of this class once EchoCanceller3
8987
// development is done.

modules/audio_processing/aec3/echo_path_delay_estimator_unittest.cc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ TEST(EchoPathDelayEstimator, DelayEstimation) {
7878
constexpr size_t kDownSamplingFactors[] = {2, 4, 8};
7979
for (auto down_sampling_factor : kDownSamplingFactors) {
8080
EchoCanceller3Config config;
81-
config.delay.delay_headroom_samples = 0;
8281
config.delay.down_sampling_factor = down_sampling_factor;
8382
config.delay.num_filters = 10;
8483
for (size_t delay_samples : {30, 64, 150, 200, 800, 4000}) {
@@ -112,13 +111,12 @@ TEST(EchoPathDelayEstimator, DelayEstimation) {
112111
}
113112

114113
if (estimated_delay_samples) {
115-
// Allow estimated delay to be off by a block as internally the delay is
116-
// quantized with an error up to a block.
114+
// Allow estimated delay to be off by one sample in the down-sampled
115+
// domain.
117116
size_t delay_ds = delay_samples / down_sampling_factor;
118117
size_t estimated_delay_ds =
119118
estimated_delay_samples->delay / down_sampling_factor;
120-
EXPECT_NEAR(delay_ds, estimated_delay_ds,
121-
kBlockSize / down_sampling_factor);
119+
EXPECT_NEAR(delay_ds, estimated_delay_ds, 1);
122120
} else {
123121
ADD_FAILURE();
124122
}

0 commit comments

Comments
 (0)