AEC3: Add support for logging warnings on delay buffer changes

This reintroduces the WARNING log level of a previous CL [1],
via a default-off config flag.

[1] https://webrtc-review.googlesource.com/c/src/+/148528

Bug: None
Change-Id: Ica8583cbb24a1611cfc684ae02d5a0f582004024
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/156566
Commit-Queue: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#29489}
This commit is contained in:
Sam Zackrisson
2019-10-15 13:43:02 +02:00
committed by Commit Bot
parent e8a6bc3f25
commit ffc8452730
6 changed files with 37 additions and 15 deletions

View File

@ -48,6 +48,7 @@ struct RTC_EXPORT EchoCanceller3Config {
} delay_selection_thresholds = {5, 20};
bool use_external_delay_estimator = false;
bool downmix_before_delay_estimation = true;
bool log_warning_on_delay_changes = false;
} delay;
struct Filter {

View File

@ -173,6 +173,8 @@ void Aec3ConfigFromJsonString(absl::string_view json_string,
&cfg.delay.use_external_delay_estimator);
ReadParam(section, "downmix_before_delay_estimation",
&cfg.delay.downmix_before_delay_estimation);
ReadParam(section, "log_warning_on_delay_changes",
&cfg.delay.log_warning_on_delay_changes);
}
if (rtc::GetValueFromJsonObject(aec3_root, "filter", &section)) {
@ -361,7 +363,10 @@ std::string Aec3ConfigToJsonString(const EchoCanceller3Config& config) {
ost << "\"use_external_delay_estimator\": "
<< (config.delay.use_external_delay_estimator ? "true" : "false") << ",";
ost << "\"downmix_before_delay_estimation\": "
<< (config.delay.downmix_before_delay_estimation ? "true" : "false");
<< (config.delay.downmix_before_delay_estimation ? "true" : "false")
<< ",";
ost << "\"log_warning_on_delay_changes\": "
<< (config.delay.log_warning_on_delay_changes ? "true" : "false");
ost << "},";
ost << "\"filter\": {";

View File

@ -18,6 +18,7 @@ namespace webrtc {
TEST(EchoCanceller3JsonHelpers, ToStringAndParseJson) {
EchoCanceller3Config cfg;
cfg.delay.down_sampling_factor = 1u;
cfg.delay.log_warning_on_delay_changes = true;
cfg.filter.shadow_initial.length_blocks = 7u;
cfg.suppressor.normal_tuning.mask_hf.enr_suppress = .5f;
std::string json_string = Aec3ConfigToJsonString(cfg);
@ -34,6 +35,8 @@ TEST(EchoCanceller3JsonHelpers, ToStringAndParseJson) {
// Expect changed values to carry through the transformation.
EXPECT_EQ(cfg.delay.down_sampling_factor,
cfg_transformed.delay.down_sampling_factor);
EXPECT_EQ(cfg.delay.log_warning_on_delay_changes,
cfg_transformed.delay.log_warning_on_delay_changes);
EXPECT_EQ(cfg.filter.shadow_initial.length_blocks,
cfg_transformed.filter.shadow_initial.length_blocks);
EXPECT_EQ(cfg.suppressor.normal_tuning.mask_hf.enr_suppress,