Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: webrtc/modules/audio_processing/audio_processing_impl.cc

Issue 2405403003: Add empty residual echo detector. (Closed)
Patch Set: Moved responsibility for proper locking to APM. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 10
(...skipping 17 matching lines...) Expand all
28 #include "webrtc/modules/audio_processing/echo_control_mobile_impl.h" 28 #include "webrtc/modules/audio_processing/echo_control_mobile_impl.h"
29 #include "webrtc/modules/audio_processing/gain_control_for_experimental_agc.h" 29 #include "webrtc/modules/audio_processing/gain_control_for_experimental_agc.h"
30 #include "webrtc/modules/audio_processing/gain_control_impl.h" 30 #include "webrtc/modules/audio_processing/gain_control_impl.h"
31 #include "webrtc/modules/audio_processing/high_pass_filter_impl.h" 31 #include "webrtc/modules/audio_processing/high_pass_filter_impl.h"
32 #if WEBRTC_INTELLIGIBILITY_ENHANCER 32 #if WEBRTC_INTELLIGIBILITY_ENHANCER
33 #include "webrtc/modules/audio_processing/intelligibility/intelligibility_enhanc er.h" 33 #include "webrtc/modules/audio_processing/intelligibility/intelligibility_enhanc er.h"
34 #endif 34 #endif
35 #include "webrtc/modules/audio_processing/level_controller/level_controller.h" 35 #include "webrtc/modules/audio_processing/level_controller/level_controller.h"
36 #include "webrtc/modules/audio_processing/level_estimator_impl.h" 36 #include "webrtc/modules/audio_processing/level_estimator_impl.h"
37 #include "webrtc/modules/audio_processing/noise_suppression_impl.h" 37 #include "webrtc/modules/audio_processing/noise_suppression_impl.h"
38 #include "webrtc/modules/audio_processing/residual_echo_detector.h"
38 #include "webrtc/modules/audio_processing/transient/transient_suppressor.h" 39 #include "webrtc/modules/audio_processing/transient/transient_suppressor.h"
39 #include "webrtc/modules/audio_processing/voice_detection_impl.h" 40 #include "webrtc/modules/audio_processing/voice_detection_impl.h"
40 #include "webrtc/modules/include/module_common_types.h" 41 #include "webrtc/modules/include/module_common_types.h"
41 #include "webrtc/system_wrappers/include/file_wrapper.h" 42 #include "webrtc/system_wrappers/include/file_wrapper.h"
42 #include "webrtc/system_wrappers/include/logging.h" 43 #include "webrtc/system_wrappers/include/logging.h"
43 #include "webrtc/system_wrappers/include/metrics.h" 44 #include "webrtc/system_wrappers/include/metrics.h"
44 45
45 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP 46 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
46 // Files generated at build-time by the protobuf compiler. 47 // Files generated at build-time by the protobuf compiler.
47 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD 48 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 124
124 // Throughout webrtc, it's assumed that success is represented by zero. 125 // Throughout webrtc, it's assumed that success is represented by zero.
125 static_assert(AudioProcessing::kNoError == 0, "kNoError must be zero"); 126 static_assert(AudioProcessing::kNoError == 0, "kNoError must be zero");
126 127
127 AudioProcessingImpl::ApmSubmoduleStates::ApmSubmoduleStates() {} 128 AudioProcessingImpl::ApmSubmoduleStates::ApmSubmoduleStates() {}
128 129
129 bool AudioProcessingImpl::ApmSubmoduleStates::Update( 130 bool AudioProcessingImpl::ApmSubmoduleStates::Update(
130 bool high_pass_filter_enabled, 131 bool high_pass_filter_enabled,
131 bool echo_canceller_enabled, 132 bool echo_canceller_enabled,
132 bool mobile_echo_controller_enabled, 133 bool mobile_echo_controller_enabled,
134 bool residual_echo_detector_enabled,
133 bool noise_suppressor_enabled, 135 bool noise_suppressor_enabled,
134 bool intelligibility_enhancer_enabled, 136 bool intelligibility_enhancer_enabled,
135 bool beamformer_enabled, 137 bool beamformer_enabled,
136 bool adaptive_gain_controller_enabled, 138 bool adaptive_gain_controller_enabled,
137 bool level_controller_enabled, 139 bool level_controller_enabled,
138 bool voice_activity_detector_enabled, 140 bool voice_activity_detector_enabled,
139 bool level_estimator_enabled, 141 bool level_estimator_enabled,
140 bool transient_suppressor_enabled) { 142 bool transient_suppressor_enabled) {
141 bool changed = false; 143 bool changed = false;
142 changed |= (high_pass_filter_enabled != high_pass_filter_enabled_); 144 changed |= (high_pass_filter_enabled != high_pass_filter_enabled_);
143 changed |= (echo_canceller_enabled != echo_canceller_enabled_); 145 changed |= (echo_canceller_enabled != echo_canceller_enabled_);
144 changed |= 146 changed |=
145 (mobile_echo_controller_enabled != mobile_echo_controller_enabled_); 147 (mobile_echo_controller_enabled != mobile_echo_controller_enabled_);
148 changed |=
149 (residual_echo_detector_enabled != residual_echo_detector_enabled_);
146 changed |= (noise_suppressor_enabled != noise_suppressor_enabled_); 150 changed |= (noise_suppressor_enabled != noise_suppressor_enabled_);
147 changed |= 151 changed |=
148 (intelligibility_enhancer_enabled != intelligibility_enhancer_enabled_); 152 (intelligibility_enhancer_enabled != intelligibility_enhancer_enabled_);
149 changed |= (beamformer_enabled != beamformer_enabled_); 153 changed |= (beamformer_enabled != beamformer_enabled_);
150 changed |= 154 changed |=
151 (adaptive_gain_controller_enabled != adaptive_gain_controller_enabled_); 155 (adaptive_gain_controller_enabled != adaptive_gain_controller_enabled_);
152 changed |= (level_controller_enabled != level_controller_enabled_); 156 changed |= (level_controller_enabled != level_controller_enabled_);
153 changed |= (level_estimator_enabled != level_estimator_enabled_); 157 changed |= (level_estimator_enabled != level_estimator_enabled_);
154 changed |= 158 changed |=
155 (voice_activity_detector_enabled != voice_activity_detector_enabled_); 159 (voice_activity_detector_enabled != voice_activity_detector_enabled_);
156 changed |= (transient_suppressor_enabled != transient_suppressor_enabled_); 160 changed |= (transient_suppressor_enabled != transient_suppressor_enabled_);
157 if (changed) { 161 if (changed) {
158 high_pass_filter_enabled_ = high_pass_filter_enabled; 162 high_pass_filter_enabled_ = high_pass_filter_enabled;
159 echo_canceller_enabled_ = echo_canceller_enabled; 163 echo_canceller_enabled_ = echo_canceller_enabled;
160 mobile_echo_controller_enabled_ = mobile_echo_controller_enabled; 164 mobile_echo_controller_enabled_ = mobile_echo_controller_enabled;
165 residual_echo_detector_enabled_ = residual_echo_detector_enabled;
161 noise_suppressor_enabled_ = noise_suppressor_enabled; 166 noise_suppressor_enabled_ = noise_suppressor_enabled;
162 intelligibility_enhancer_enabled_ = intelligibility_enhancer_enabled; 167 intelligibility_enhancer_enabled_ = intelligibility_enhancer_enabled;
163 beamformer_enabled_ = beamformer_enabled; 168 beamformer_enabled_ = beamformer_enabled;
164 adaptive_gain_controller_enabled_ = adaptive_gain_controller_enabled; 169 adaptive_gain_controller_enabled_ = adaptive_gain_controller_enabled;
165 level_controller_enabled_ = level_controller_enabled; 170 level_controller_enabled_ = level_controller_enabled;
166 level_estimator_enabled_ = level_estimator_enabled; 171 level_estimator_enabled_ = level_estimator_enabled;
167 voice_activity_detector_enabled_ = voice_activity_detector_enabled; 172 voice_activity_detector_enabled_ = voice_activity_detector_enabled;
168 transient_suppressor_enabled_ = transient_suppressor_enabled; 173 transient_suppressor_enabled_ = transient_suppressor_enabled;
169 } 174 }
170 175
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 #endif 230 #endif
226 }; 231 };
227 232
228 struct AudioProcessingImpl::ApmPrivateSubmodules { 233 struct AudioProcessingImpl::ApmPrivateSubmodules {
229 explicit ApmPrivateSubmodules(NonlinearBeamformer* beamformer) 234 explicit ApmPrivateSubmodules(NonlinearBeamformer* beamformer)
230 : beamformer(beamformer) {} 235 : beamformer(beamformer) {}
231 // Accessed internally from capture or during initialization 236 // Accessed internally from capture or during initialization
232 std::unique_ptr<NonlinearBeamformer> beamformer; 237 std::unique_ptr<NonlinearBeamformer> beamformer;
233 std::unique_ptr<AgcManagerDirect> agc_manager; 238 std::unique_ptr<AgcManagerDirect> agc_manager;
234 std::unique_ptr<LevelController> level_controller; 239 std::unique_ptr<LevelController> level_controller;
240 std::unique_ptr<ResidualEchoDetector> residual_echo_detector;
235 }; 241 };
236 242
237 AudioProcessing* AudioProcessing::Create() { 243 AudioProcessing* AudioProcessing::Create() {
238 webrtc::Config config; 244 webrtc::Config config;
239 return Create(config, nullptr); 245 return Create(config, nullptr);
240 } 246 }
241 247
242 AudioProcessing* AudioProcessing::Create(const webrtc::Config& config) { 248 AudioProcessing* AudioProcessing::Create(const webrtc::Config& config) {
243 return Create(config, nullptr); 249 return Create(config, nullptr);
244 } 250 }
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 new HighPassFilterImpl(&crit_capture_)); 296 new HighPassFilterImpl(&crit_capture_));
291 public_submodules_->level_estimator.reset( 297 public_submodules_->level_estimator.reset(
292 new LevelEstimatorImpl(&crit_capture_)); 298 new LevelEstimatorImpl(&crit_capture_));
293 public_submodules_->noise_suppression.reset( 299 public_submodules_->noise_suppression.reset(
294 new NoiseSuppressionImpl(&crit_capture_)); 300 new NoiseSuppressionImpl(&crit_capture_));
295 public_submodules_->voice_detection.reset( 301 public_submodules_->voice_detection.reset(
296 new VoiceDetectionImpl(&crit_capture_)); 302 new VoiceDetectionImpl(&crit_capture_));
297 public_submodules_->gain_control_for_experimental_agc.reset( 303 public_submodules_->gain_control_for_experimental_agc.reset(
298 new GainControlForExperimentalAgc( 304 new GainControlForExperimentalAgc(
299 public_submodules_->gain_control.get(), &crit_capture_)); 305 public_submodules_->gain_control.get(), &crit_capture_));
306 private_submodules_->residual_echo_detector.reset(
307 new ResidualEchoDetector());
300 308
301 // TODO(peah): Move this creation to happen only when the level controller 309 // TODO(peah): Move this creation to happen only when the level controller
302 // is enabled. 310 // is enabled.
303 private_submodules_->level_controller.reset(new LevelController()); 311 private_submodules_->level_controller.reset(new LevelController());
304 } 312 }
305 313
306 SetExtraOptions(config); 314 SetExtraOptions(config);
307 } 315 }
308 316
309 AudioProcessingImpl::~AudioProcessingImpl() { 317 AudioProcessingImpl::~AudioProcessingImpl() {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 #if WEBRTC_INTELLIGIBILITY_ENHANCER 460 #if WEBRTC_INTELLIGIBILITY_ENHANCER
453 InitializeIntelligibility(); 461 InitializeIntelligibility();
454 #endif 462 #endif
455 public_submodules_->high_pass_filter->Initialize(num_proc_channels(), 463 public_submodules_->high_pass_filter->Initialize(num_proc_channels(),
456 proc_sample_rate_hz()); 464 proc_sample_rate_hz());
457 public_submodules_->noise_suppression->Initialize(num_proc_channels(), 465 public_submodules_->noise_suppression->Initialize(num_proc_channels(),
458 proc_sample_rate_hz()); 466 proc_sample_rate_hz());
459 public_submodules_->voice_detection->Initialize(proc_split_sample_rate_hz()); 467 public_submodules_->voice_detection->Initialize(proc_split_sample_rate_hz());
460 public_submodules_->level_estimator->Initialize(); 468 public_submodules_->level_estimator->Initialize();
461 InitializeLevelController(); 469 InitializeLevelController();
470 InitializeResidualEchoDetector();
462 471
463 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP 472 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
464 if (debug_dump_.debug_file->is_open()) { 473 if (debug_dump_.debug_file->is_open()) {
465 int err = WriteInitMessage(); 474 int err = WriteInitMessage();
466 if (err != kNoError) { 475 if (err != kNoError) {
467 return err; 476 return err;
468 } 477 }
469 } 478 }
470 #endif 479 #endif
471 480
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 ProcessingConfig processing_config; 702 ProcessingConfig processing_config;
694 bool reinitialization_required = false; 703 bool reinitialization_required = false;
695 { 704 {
696 // Acquire the capture lock in order to safely call the function 705 // Acquire the capture lock in order to safely call the function
697 // that retrieves the render side data. This function accesses apm 706 // that retrieves the render side data. This function accesses apm
698 // getters that need the capture lock held when being called. 707 // getters that need the capture lock held when being called.
699 rtc::CritScope cs_capture(&crit_capture_); 708 rtc::CritScope cs_capture(&crit_capture_);
700 public_submodules_->echo_cancellation->ReadQueuedRenderData(); 709 public_submodules_->echo_cancellation->ReadQueuedRenderData();
701 public_submodules_->echo_control_mobile->ReadQueuedRenderData(); 710 public_submodules_->echo_control_mobile->ReadQueuedRenderData();
702 public_submodules_->gain_control->ReadQueuedRenderData(); 711 public_submodules_->gain_control->ReadQueuedRenderData();
712 private_submodules_->residual_echo_detector->ReadQueuedRenderData();
703 713
704 if (!src || !dest) { 714 if (!src || !dest) {
705 return kNullPointerError; 715 return kNullPointerError;
706 } 716 }
707 717
708 processing_config = formats_.api_format; 718 processing_config = formats_.api_format;
709 reinitialization_required = UpdateActiveSubmoduleStates(); 719 reinitialization_required = UpdateActiveSubmoduleStates();
710 } 720 }
711 721
712 processing_config.input_stream() = input_config; 722 processing_config.input_stream() = input_config;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 // Acquire the capture lock in order to safely call the function 773 // Acquire the capture lock in order to safely call the function
764 // that retrieves the render side data. This function accesses apm 774 // that retrieves the render side data. This function accesses apm
765 // getters that need the capture lock held when being called. 775 // getters that need the capture lock held when being called.
766 // The lock needs to be released as 776 // The lock needs to be released as
767 // public_submodules_->echo_control_mobile->is_enabled() aquires this lock 777 // public_submodules_->echo_control_mobile->is_enabled() aquires this lock
768 // as well. 778 // as well.
769 rtc::CritScope cs_capture(&crit_capture_); 779 rtc::CritScope cs_capture(&crit_capture_);
770 public_submodules_->echo_cancellation->ReadQueuedRenderData(); 780 public_submodules_->echo_cancellation->ReadQueuedRenderData();
771 public_submodules_->echo_control_mobile->ReadQueuedRenderData(); 781 public_submodules_->echo_control_mobile->ReadQueuedRenderData();
772 public_submodules_->gain_control->ReadQueuedRenderData(); 782 public_submodules_->gain_control->ReadQueuedRenderData();
783 private_submodules_->residual_echo_detector->ReadQueuedRenderData();
773 } 784 }
774 785
775 if (!frame) { 786 if (!frame) {
776 return kNullPointerError; 787 return kNullPointerError;
777 } 788 }
778 // Must be a native rate. 789 // Must be a native rate.
779 if (frame->sample_rate_hz_ != kSampleRate8kHz && 790 if (frame->sample_rate_hz_ != kSampleRate8kHz &&
780 frame->sample_rate_hz_ != kSampleRate16kHz && 791 frame->sample_rate_hz_ != kSampleRate16kHz &&
781 frame->sample_rate_hz_ != kSampleRate32kHz && 792 frame->sample_rate_hz_ != kSampleRate32kHz &&
782 frame->sample_rate_hz_ != kSampleRate48kHz) { 793 frame->sample_rate_hz_ != kSampleRate48kHz) {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
925 // Ensure that the stream delay was set before the call to the 936 // Ensure that the stream delay was set before the call to the
926 // AECM ProcessCaptureAudio function. 937 // AECM ProcessCaptureAudio function.
927 if (public_submodules_->echo_control_mobile->is_enabled() && 938 if (public_submodules_->echo_control_mobile->is_enabled() &&
928 !was_stream_delay_set()) { 939 !was_stream_delay_set()) {
929 return AudioProcessing::kStreamParameterNotSetError; 940 return AudioProcessing::kStreamParameterNotSetError;
930 } 941 }
931 942
932 RETURN_ON_ERR(public_submodules_->echo_control_mobile->ProcessCaptureAudio( 943 RETURN_ON_ERR(public_submodules_->echo_control_mobile->ProcessCaptureAudio(
933 capture_buffer, stream_delay_ms())); 944 capture_buffer, stream_delay_ms()));
934 945
946 if (config_.residual_echo_detector.enabled) {
947 private_submodules_->residual_echo_detector->AnalyzeCaptureAudio(
948 capture_buffer);
949 }
950
935 if (capture_nonlocked_.beamformer_enabled) { 951 if (capture_nonlocked_.beamformer_enabled) {
936 private_submodules_->beamformer->PostFilter(capture_buffer->split_data_f()); 952 private_submodules_->beamformer->PostFilter(capture_buffer->split_data_f());
937 } 953 }
938 954
939 public_submodules_->voice_detection->ProcessCaptureAudio(capture_buffer); 955 public_submodules_->voice_detection->ProcessCaptureAudio(capture_buffer);
940 956
941 if (constants_.use_experimental_agc && 957 if (constants_.use_experimental_agc &&
942 public_submodules_->gain_control->is_enabled() && 958 public_submodules_->gain_control->is_enabled() &&
943 (!capture_nonlocked_.beamformer_enabled || 959 (!capture_nonlocked_.beamformer_enabled ||
944 private_submodules_->beamformer->is_target_present())) { 960 private_submodules_->beamformer->is_target_present())) {
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 if (capture_nonlocked_.intelligibility_enabled) { 1143 if (capture_nonlocked_.intelligibility_enabled) {
1128 public_submodules_->intelligibility_enhancer->ProcessRenderAudio( 1144 public_submodules_->intelligibility_enhancer->ProcessRenderAudio(
1129 render_buffer); 1145 render_buffer);
1130 } 1146 }
1131 #endif 1147 #endif
1132 1148
1133 RETURN_ON_ERR( 1149 RETURN_ON_ERR(
1134 public_submodules_->echo_cancellation->ProcessRenderAudio(render_buffer)); 1150 public_submodules_->echo_cancellation->ProcessRenderAudio(render_buffer));
1135 RETURN_ON_ERR(public_submodules_->echo_control_mobile->ProcessRenderAudio( 1151 RETURN_ON_ERR(public_submodules_->echo_control_mobile->ProcessRenderAudio(
1136 render_buffer)); 1152 render_buffer));
1153 if (config_.residual_echo_detector.enabled) {
1154 if (private_submodules_->residual_echo_detector->AnalyzeRenderAudio(
1155 render_buffer) != 0) {
1156 {
1157 rtc::CritScope cs(&crit_capture_);
1158 // The data queue is full and needs to be emptied.
1159 private_submodules_->residual_echo_detector->ReadQueuedRenderData();
1160 }
1161
1162 // Retry the insert (should always work).
1163 int reinsert =
1164 private_submodules_->residual_echo_detector->AnalyzeRenderAudio(
1165 render_buffer);
1166 RTC_DCHECK_EQ(reinsert, 0);
1167 }
1168 }
1137 if (!constants_.use_experimental_agc) { 1169 if (!constants_.use_experimental_agc) {
1138 RETURN_ON_ERR( 1170 RETURN_ON_ERR(
1139 public_submodules_->gain_control->ProcessRenderAudio(render_buffer)); 1171 public_submodules_->gain_control->ProcessRenderAudio(render_buffer));
1140 } 1172 }
1141 1173
1142 if (submodule_states_.RenderMultiBandProcessingActive() && 1174 if (submodule_states_.RenderMultiBandProcessingActive() &&
1143 SampleRateSupportsMultiBand( 1175 SampleRateSupportsMultiBand(
1144 formats_.render_processing_format.sample_rate_hz())) { 1176 formats_.render_processing_format.sample_rate_hz())) {
1145 render_buffer->MergeFrequencyBands(); 1177 render_buffer->MergeFrequencyBands();
1146 } 1178 }
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1303 1335
1304 VoiceDetection* AudioProcessingImpl::voice_detection() const { 1336 VoiceDetection* AudioProcessingImpl::voice_detection() const {
1305 return public_submodules_->voice_detection.get(); 1337 return public_submodules_->voice_detection.get();
1306 } 1338 }
1307 1339
1308 bool AudioProcessingImpl::UpdateActiveSubmoduleStates() { 1340 bool AudioProcessingImpl::UpdateActiveSubmoduleStates() {
1309 return submodule_states_.Update( 1341 return submodule_states_.Update(
1310 public_submodules_->high_pass_filter->is_enabled(), 1342 public_submodules_->high_pass_filter->is_enabled(),
1311 public_submodules_->echo_cancellation->is_enabled(), 1343 public_submodules_->echo_cancellation->is_enabled(),
1312 public_submodules_->echo_control_mobile->is_enabled(), 1344 public_submodules_->echo_control_mobile->is_enabled(),
1345 config_.residual_echo_detector.enabled,
1313 public_submodules_->noise_suppression->is_enabled(), 1346 public_submodules_->noise_suppression->is_enabled(),
1314 capture_nonlocked_.intelligibility_enabled, 1347 capture_nonlocked_.intelligibility_enabled,
1315 capture_nonlocked_.beamformer_enabled, 1348 capture_nonlocked_.beamformer_enabled,
1316 public_submodules_->gain_control->is_enabled(), 1349 public_submodules_->gain_control->is_enabled(),
1317 capture_nonlocked_.level_controller_enabled, 1350 capture_nonlocked_.level_controller_enabled,
1318 public_submodules_->voice_detection->is_enabled(), 1351 public_submodules_->voice_detection->is_enabled(),
1319 public_submodules_->level_estimator->is_enabled(), 1352 public_submodules_->level_estimator->is_enabled(),
1320 capture_.transient_suppressor_enabled); 1353 capture_.transient_suppressor_enabled);
1321 } 1354 }
1322 1355
(...skipping 29 matching lines...) Expand all
1352 render_.render_audio->num_bands(), 1385 render_.render_audio->num_bands(),
1353 NoiseSuppressionImpl::num_noise_bins())); 1386 NoiseSuppressionImpl::num_noise_bins()));
1354 } 1387 }
1355 #endif 1388 #endif
1356 } 1389 }
1357 1390
1358 void AudioProcessingImpl::InitializeLevelController() { 1391 void AudioProcessingImpl::InitializeLevelController() {
1359 private_submodules_->level_controller->Initialize(proc_sample_rate_hz()); 1392 private_submodules_->level_controller->Initialize(proc_sample_rate_hz());
1360 } 1393 }
1361 1394
1395 void AudioProcessingImpl::InitializeResidualEchoDetector() {
1396 private_submodules_->residual_echo_detector->Initialize(
1397 proc_sample_rate_hz());
1398 }
1399
1362 void AudioProcessingImpl::MaybeUpdateHistograms() { 1400 void AudioProcessingImpl::MaybeUpdateHistograms() {
1363 static const int kMinDiffDelayMs = 60; 1401 static const int kMinDiffDelayMs = 60;
1364 1402
1365 if (echo_cancellation()->is_enabled()) { 1403 if (echo_cancellation()->is_enabled()) {
1366 // Activate delay_jumps_ counters if we know echo_cancellation is runnning. 1404 // Activate delay_jumps_ counters if we know echo_cancellation is runnning.
1367 // If a stream has echo we know that the echo_cancellation is in process. 1405 // If a stream has echo we know that the echo_cancellation is in process.
1368 if (capture_.stream_delay_jumps == -1 && 1406 if (capture_.stream_delay_jumps == -1 &&
1369 echo_cancellation()->stream_has_echo()) { 1407 echo_cancellation()->stream_has_echo()) {
1370 capture_.stream_delay_jumps = 0; 1408 capture_.stream_delay_jumps = 0;
1371 } 1409 }
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1590 capture_processing_format(kSampleRate16kHz), 1628 capture_processing_format(kSampleRate16kHz),
1591 split_rate(kSampleRate16kHz) {} 1629 split_rate(kSampleRate16kHz) {}
1592 1630
1593 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default; 1631 AudioProcessingImpl::ApmCaptureState::~ApmCaptureState() = default;
1594 1632
1595 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default; 1633 AudioProcessingImpl::ApmRenderState::ApmRenderState() = default;
1596 1634
1597 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default; 1635 AudioProcessingImpl::ApmRenderState::~ApmRenderState() = default;
1598 1636
1599 } // namespace webrtc 1637 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698