OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 #include "webrtc/modules/audio_processing/aec3/echo_remover.h" | 10 #include "webrtc/modules/audio_processing/aec3/echo_remover.h" |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 std::vector<std::vector<float>>* capture) override; | 65 std::vector<std::vector<float>>* capture) override; |
66 | 66 |
67 // Updates the status on whether echo leakage is detected in the output of the | 67 // Updates the status on whether echo leakage is detected in the output of the |
68 // echo remover. | 68 // echo remover. |
69 void UpdateEchoLeakageStatus(bool leakage_detected) override { | 69 void UpdateEchoLeakageStatus(bool leakage_detected) override { |
70 echo_leakage_detected_ = leakage_detected; | 70 echo_leakage_detected_ = leakage_detected; |
71 } | 71 } |
72 | 72 |
73 private: | 73 private: |
74 static int instance_count_; | 74 static int instance_count_; |
| 75 const AudioProcessing::Config::EchoCanceller3 config_; |
75 const Aec3Fft fft_; | 76 const Aec3Fft fft_; |
76 std::unique_ptr<ApmDataDumper> data_dumper_; | 77 std::unique_ptr<ApmDataDumper> data_dumper_; |
77 const Aec3Optimization optimization_; | 78 const Aec3Optimization optimization_; |
78 const int sample_rate_hz_; | 79 const int sample_rate_hz_; |
79 Subtractor subtractor_; | 80 Subtractor subtractor_; |
80 SuppressionGain suppression_gain_; | 81 SuppressionGain suppression_gain_; |
81 ComfortNoiseGenerator cng_; | 82 ComfortNoiseGenerator cng_; |
82 SuppressionFilter suppression_filter_; | 83 SuppressionFilter suppression_filter_; |
83 RenderSignalAnalyzer render_signal_analyzer_; | 84 RenderSignalAnalyzer render_signal_analyzer_; |
84 OutputSelector output_selector_; | 85 OutputSelector output_selector_; |
85 ResidualEchoEstimator residual_echo_estimator_; | 86 ResidualEchoEstimator residual_echo_estimator_; |
86 bool echo_leakage_detected_ = false; | 87 bool echo_leakage_detected_ = false; |
87 AecState aec_state_; | 88 AecState aec_state_; |
88 EchoRemoverMetrics metrics_; | 89 EchoRemoverMetrics metrics_; |
89 | 90 |
90 RTC_DISALLOW_COPY_AND_ASSIGN(EchoRemoverImpl); | 91 RTC_DISALLOW_COPY_AND_ASSIGN(EchoRemoverImpl); |
91 }; | 92 }; |
92 | 93 |
93 int EchoRemoverImpl::instance_count_ = 0; | 94 int EchoRemoverImpl::instance_count_ = 0; |
94 | 95 |
95 EchoRemoverImpl::EchoRemoverImpl( | 96 EchoRemoverImpl::EchoRemoverImpl( |
96 const AudioProcessing::Config::EchoCanceller3& config, | 97 const AudioProcessing::Config::EchoCanceller3& config, |
97 int sample_rate_hz) | 98 int sample_rate_hz) |
98 : fft_(), | 99 : config_(config), |
| 100 fft_(), |
99 data_dumper_( | 101 data_dumper_( |
100 new ApmDataDumper(rtc::AtomicOps::Increment(&instance_count_))), | 102 new ApmDataDumper(rtc::AtomicOps::Increment(&instance_count_))), |
101 optimization_(DetectOptimization()), | 103 optimization_(DetectOptimization()), |
102 sample_rate_hz_(sample_rate_hz), | 104 sample_rate_hz_(sample_rate_hz), |
103 subtractor_(data_dumper_.get(), optimization_), | 105 subtractor_(data_dumper_.get(), optimization_), |
104 suppression_gain_(optimization_), | 106 suppression_gain_(config_, optimization_), |
105 cng_(optimization_), | 107 cng_(optimization_), |
106 suppression_filter_(sample_rate_hz_), | 108 suppression_filter_(sample_rate_hz_), |
107 aec_state_(0.8f) { | 109 residual_echo_estimator_(config_), |
| 110 aec_state_(config_) { |
108 RTC_DCHECK(ValidFullBandRate(sample_rate_hz)); | 111 RTC_DCHECK(ValidFullBandRate(sample_rate_hz)); |
109 } | 112 } |
110 | 113 |
111 EchoRemoverImpl::~EchoRemoverImpl() = default; | 114 EchoRemoverImpl::~EchoRemoverImpl() = default; |
112 | 115 |
113 void EchoRemoverImpl::ProcessCapture( | 116 void EchoRemoverImpl::ProcessCapture( |
114 const rtc::Optional<size_t>& echo_path_delay_samples, | 117 const rtc::Optional<size_t>& echo_path_delay_samples, |
115 const EchoPathVariability& echo_path_variability, | 118 const EchoPathVariability& echo_path_variability, |
116 bool capture_signal_saturation, | 119 bool capture_signal_saturation, |
117 const RenderBuffer& render_buffer, | 120 const RenderBuffer& render_buffer, |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 243 |
241 } // namespace | 244 } // namespace |
242 | 245 |
243 EchoRemover* EchoRemover::Create( | 246 EchoRemover* EchoRemover::Create( |
244 const AudioProcessing::Config::EchoCanceller3& config, | 247 const AudioProcessing::Config::EchoCanceller3& config, |
245 int sample_rate_hz) { | 248 int sample_rate_hz) { |
246 return new EchoRemoverImpl(config, sample_rate_hz); | 249 return new EchoRemoverImpl(config, sample_rate_hz); |
247 } | 250 } |
248 | 251 |
249 } // namespace webrtc | 252 } // namespace webrtc |
OLD | NEW |