echo_canceller3_factory.cc (2052B)
1 /* 2 * Copyright (c) 2018 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 #include "api/audio/echo_canceller3_factory.h" 11 12 #include <memory> 13 #include <optional> 14 15 #include "absl/base/nullability.h" 16 #include "api/audio/echo_canceller3_config.h" 17 #include "api/audio/echo_control.h" 18 #include "api/audio/neural_residual_echo_estimator.h" 19 #include "api/environment/environment.h" 20 #include "modules/audio_processing/aec3/echo_canceller3.h" 21 22 namespace webrtc { 23 24 EchoCanceller3Factory::EchoCanceller3Factory() {} 25 26 EchoCanceller3Factory::EchoCanceller3Factory(const EchoCanceller3Config& config) 27 : config_(config), multichannel_config_(std::nullopt) {} 28 29 EchoCanceller3Factory::EchoCanceller3Factory( 30 const EchoCanceller3Config& config, 31 std::optional<EchoCanceller3Config> multichannel_config) 32 : config_(config), multichannel_config_(multichannel_config) {} 33 34 absl_nonnull std::unique_ptr<EchoControl> EchoCanceller3Factory::Create( 35 const Environment& env, 36 int sample_rate_hz, 37 int num_render_channels, 38 int num_capture_channels) { 39 return std::make_unique<EchoCanceller3>( 40 env, config_, multichannel_config_, 41 /*neural_residual_echo_estimator=*/nullptr, sample_rate_hz, 42 num_render_channels, num_capture_channels); 43 } 44 45 absl_nonnull std::unique_ptr<EchoControl> EchoCanceller3Factory::Create( 46 const Environment& env, 47 int sample_rate_hz, 48 int num_render_channels, 49 int num_capture_channels, 50 NeuralResidualEchoEstimator* neural_residual_echo_estimator) { 51 return std::make_unique<EchoCanceller3>( 52 env, config_, multichannel_config_, neural_residual_echo_estimator, 53 sample_rate_hz, num_render_channels, num_capture_channels); 54 } 55 56 } // namespace webrtc