commit cdbb2c88ec29a3a79314d106cd91bd37bebe7134 parent d8c86591b12a91cff3d7454ecf5f28182a4b883f Author: Dan Baker <dbaker@mozilla.com> Date: Tue, 2 Dec 2025 01:00:17 -0700 Bug 2000941 - Vendor libwebrtc from 20e71a25d4 Upstream commit: https://webrtc.googlesource.com/src/+/20e71a25d4d77c74257d820de27b82be386e2028 Passing a neural echo residual estimator pointer to the echo control factory. As we need to provide a default implementation for the added API, the old ones have not been yet marked as [[deprecated]]. Bug: webrtc:442444736 Change-Id: I86ab70b4ac2ce91ff435e02d76e613d29be5498c Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/411461 Reviewed-by: Sam Zackrisson <saza@webrtc.org> Commit-Queue: Jesus de Vicente Pena <devicentepena@webrtc.org> Reviewed-by: Per Ã…hgren <peah@webrtc.org> Cr-Commit-Position: refs/heads/main@{#45746} Diffstat:
8 files changed, 48 insertions(+), 4 deletions(-)
diff --git a/third_party/libwebrtc/README.mozilla.last-vendor b/third_party/libwebrtc/README.mozilla.last-vendor @@ -1,4 +1,4 @@ # ./mach python dom/media/webrtc/third_party_build/vendor-libwebrtc.py --from-local /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc --commit mozpatches libwebrtc -libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-12-02T07:57:45.213733+00:00. +libwebrtc updated from /Users/danielbaker/elm/.moz-fast-forward/moz-libwebrtc commit mozpatches on 2025-12-02T08:00:04.442988+00:00. # base of lastest vendoring -a3d63d040d +20e71a25d4 diff --git a/third_party/libwebrtc/api/audio/BUILD.gn b/third_party/libwebrtc/api/audio/BUILD.gn @@ -152,6 +152,7 @@ rtc_library("aec3_factory") { deps = [ ":aec3_config", ":echo_control", + ":neural_residual_echo_estimator_api", "../../modules/audio_processing/aec3", "../../rtc_base/system:rtc_export", "../environment", @@ -163,6 +164,7 @@ rtc_source_set("echo_control") { visibility = [ "*" ] sources = [ "echo_control.h" ] deps = [ + ":neural_residual_echo_estimator_api", "../../rtc_base:checks", "../environment", "//third_party/abseil-cpp/absl/base:nullability", diff --git a/third_party/libwebrtc/api/audio/echo_canceller3_factory.cc b/third_party/libwebrtc/api/audio/echo_canceller3_factory.cc @@ -15,6 +15,7 @@ #include "absl/base/nullability.h" #include "api/audio/echo_canceller3_config.h" #include "api/audio/echo_control.h" +#include "api/audio/neural_residual_echo_estimator.h" #include "api/environment/environment.h" #include "modules/audio_processing/aec3/echo_canceller3.h" @@ -41,4 +42,15 @@ absl_nonnull std::unique_ptr<EchoControl> EchoCanceller3Factory::Create( num_render_channels, num_capture_channels); } +absl_nonnull std::unique_ptr<EchoControl> EchoCanceller3Factory::Create( + const Environment& env, + int sample_rate_hz, + int num_render_channels, + int num_capture_channels, + NeuralResidualEchoEstimator* neural_residual_echo_estimator) { + return std::make_unique<EchoCanceller3>( + env, config_, multichannel_config_, neural_residual_echo_estimator, + sample_rate_hz, num_render_channels, num_capture_channels); +} + } // namespace webrtc diff --git a/third_party/libwebrtc/api/audio/echo_canceller3_factory.h b/third_party/libwebrtc/api/audio/echo_canceller3_factory.h @@ -17,6 +17,7 @@ #include "absl/base/nullability.h" #include "api/audio/echo_canceller3_config.h" #include "api/audio/echo_control.h" +#include "api/audio/neural_residual_echo_estimator.h" #include "api/environment/environment.h" #include "rtc_base/system/rtc_export.h" @@ -44,6 +45,16 @@ class RTC_EXPORT EchoCanceller3Factory : public EchoControlFactory { int num_render_channels, int num_capture_channels) override; + // Creates an EchoCanceller3 with a specified channel count and sampling rate. + // If provided, `neural_residual_echo_estimator` is used to estimate the + // residual echo. + absl_nonnull std::unique_ptr<EchoControl> Create( + const Environment& env, + int sample_rate_hz, + int num_render_channels, + int num_capture_channels, + NeuralResidualEchoEstimator* neural_residual_echo_estimator) override; + private: const EchoCanceller3Config config_; const std::optional<EchoCanceller3Config> multichannel_config_; diff --git a/third_party/libwebrtc/api/audio/echo_control.h b/third_party/libwebrtc/api/audio/echo_control.h @@ -14,6 +14,7 @@ #include <memory> #include "absl/base/nullability.h" +#include "api/audio/neural_residual_echo_estimator.h" #include "api/environment/environment.h" namespace webrtc { @@ -72,7 +73,18 @@ class EchoControlFactory { int sample_rate_hz, int num_render_channels, int num_capture_channels) = 0; + + virtual absl_nonnull std::unique_ptr<EchoControl> Create( + const Environment& env, + int sample_rate_hz, + int num_render_channels, + int num_capture_channels, + NeuralResidualEchoEstimator* neural_residual_echo_estimator) { + return Create(env, sample_rate_hz, num_render_channels, + num_capture_channels); + } }; + } // namespace webrtc #endif // API_AUDIO_ECHO_CONTROL_H_ diff --git a/third_party/libwebrtc/modules/audio_processing/BUILD.gn b/third_party/libwebrtc/modules/audio_processing/BUILD.gn @@ -454,6 +454,7 @@ if (rtc_include_tests) { ":runtime_settings_protobuf_utils", "../../api/audio:audio_frame_api", "../../api/audio:echo_control", + "../../api/audio:neural_residual_echo_estimator_api", "../../rtc_base:rtc_base_tests_utils", "aec_dump", "aec_dump:aec_dump_unittests", diff --git a/third_party/libwebrtc/modules/audio_processing/audio_processing_impl.cc b/third_party/libwebrtc/modules/audio_processing/audio_processing_impl.cc @@ -1912,7 +1912,8 @@ void AudioProcessingImpl::InitializeEchoController() { if (echo_control_factory_) { submodules_.echo_controller = echo_control_factory_->Create( env_, proc_sample_rate_hz(), num_reverse_channels(), - num_proc_channels()); + num_proc_channels(), + submodules_.neural_residual_echo_estimator.get()); RTC_DCHECK(submodules_.echo_controller); } else { EchoCanceller3Config config; diff --git a/third_party/libwebrtc/modules/audio_processing/audio_processing_unittest.cc b/third_party/libwebrtc/modules/audio_processing/audio_processing_unittest.cc @@ -37,6 +37,7 @@ #include "api/audio/builtin_audio_processing_builder.h" #include "api/audio/echo_control.h" #include "api/audio/echo_detector_creator.h" +#include "api/audio/neural_residual_echo_estimator.h" #include "api/environment/environment.h" #include "api/environment/environment_factory.h" #include "api/make_ref_counted.h" @@ -2610,12 +2611,16 @@ class MockEchoControlFactory : public EchoControlFactory { Create, (const Environment&, int, int, int), (override)); + MOCK_METHOD(std::unique_ptr<EchoControl>, + Create, + (const Environment&, int, int, int, NeuralResidualEchoEstimator*), + (override)); }; TEST(ApmConfiguration, EchoControlInjection) { // Verify that apm uses an injected echo controller if one is provided. auto echo_control_factory = std::make_unique<MockEchoControlFactory>(); - EXPECT_CALL(*echo_control_factory, Create(_, _, _, _)) + EXPECT_CALL(*echo_control_factory, Create(_, _, _, _, _)) .WillOnce(WithoutArgs([] { auto ec = std::make_unique<test::MockEchoControl>(); EXPECT_CALL(*ec, AnalyzeRender).Times(1);