AEC3: Add fallback to mono processing if no stereo is detected for some time
If playout audio is temporarily stereo, the AEC will currently enter stereo processing mode indefinitely. To save CPU and improve AEC performance, this CL adds support for falling back to mono after a period of no stereo. The feature is enabled by default in the AEC3 config. Bug: chromium:1295710 Change-Id: I690b5b22f8407f950bf41f3bcaa9ca0138452157 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/258421 Reviewed-by: Per Åhgren <peah@webrtc.org> Commit-Queue: Sam Zackrisson <saza@webrtc.org> Cr-Commit-Position: refs/heads/main@{#36502}
This commit is contained in:
committed by
WebRTC LUCI CQ
parent
13fe3674ff
commit
fa07b43074
@ -240,6 +240,7 @@ struct RTC_EXPORT EchoCanceller3Config {
|
||||
struct MultiChannel {
|
||||
bool detect_stereo_content = true;
|
||||
float stereo_detection_threshold = 0.0f;
|
||||
int stereo_detection_timeout_threshold_seconds = 300;
|
||||
} multi_channel;
|
||||
};
|
||||
} // namespace webrtc
|
||||
|
||||
@ -421,6 +421,8 @@ void Aec3ConfigFromJsonString(absl::string_view json_string,
|
||||
&cfg.multi_channel.detect_stereo_content);
|
||||
ReadParam(section, "stereo_detection_threshold",
|
||||
&cfg.multi_channel.stereo_detection_threshold);
|
||||
ReadParam(section, "stereo_detection_timeout_threshold_seconds",
|
||||
&cfg.multi_channel.stereo_detection_timeout_threshold_seconds);
|
||||
}
|
||||
}
|
||||
|
||||
@ -750,7 +752,9 @@ std::string Aec3ConfigToJsonString(const EchoCanceller3Config& config) {
|
||||
ost << "\"detect_stereo_content\": "
|
||||
<< (config.multi_channel.detect_stereo_content ? "true" : "false") << ",";
|
||||
ost << "\"stereo_detection_threshold\": "
|
||||
<< config.multi_channel.stereo_detection_threshold;
|
||||
<< config.multi_channel.stereo_detection_threshold << ",";
|
||||
ost << "\"stereo_detection_timeout_threshold_seconds\": "
|
||||
<< config.multi_channel.stereo_detection_timeout_threshold_seconds;
|
||||
ost << "}";
|
||||
|
||||
ost << "}";
|
||||
|
||||
@ -33,8 +33,8 @@ TEST(EchoCanceller3JsonHelpers, ToStringAndParseJson) {
|
||||
cfg.suppressor.subband_nearend_detection.snr_threshold = 100.f;
|
||||
cfg.multi_channel.detect_stereo_content =
|
||||
!cfg.multi_channel.detect_stereo_content;
|
||||
cfg.multi_channel.stereo_detection_threshold =
|
||||
cfg.multi_channel.stereo_detection_threshold + 1.0f;
|
||||
cfg.multi_channel.stereo_detection_threshold += 1.0f;
|
||||
cfg.multi_channel.stereo_detection_timeout_threshold_seconds += 1;
|
||||
std::string json_string = Aec3ConfigToJsonString(cfg);
|
||||
EchoCanceller3Config cfg_transformed = Aec3ConfigFromJsonString(json_string);
|
||||
|
||||
@ -83,5 +83,8 @@ TEST(EchoCanceller3JsonHelpers, ToStringAndParseJson) {
|
||||
cfg_transformed.multi_channel.detect_stereo_content);
|
||||
EXPECT_EQ(cfg.multi_channel.stereo_detection_threshold,
|
||||
cfg_transformed.multi_channel.stereo_detection_threshold);
|
||||
EXPECT_EQ(
|
||||
cfg.multi_channel.stereo_detection_timeout_threshold_seconds,
|
||||
cfg_transformed.multi_channel.stereo_detection_timeout_threshold_seconds);
|
||||
}
|
||||
} // namespace webrtc
|
||||
|
||||
Reference in New Issue
Block a user