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

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

Issue 1770823002: Removed the AudioProcessing dependency in EchoCancellerImpl (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@CleanUpAecImpl_CL
Patch Set: Rebase from latest master Created 4 years, 9 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
« no previous file with comments | « no previous file | webrtc/modules/audio_processing/echo_cancellation_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 #endif 161 #endif
162 config.Get<Beamforming>().array_geometry, 162 config.Get<Beamforming>().array_geometry,
163 config.Get<Beamforming>().target_direction), 163 config.Get<Beamforming>().target_direction),
164 capture_nonlocked_(config.Get<Beamforming>().enabled) 164 capture_nonlocked_(config.Get<Beamforming>().enabled)
165 { 165 {
166 { 166 {
167 rtc::CritScope cs_render(&crit_render_); 167 rtc::CritScope cs_render(&crit_render_);
168 rtc::CritScope cs_capture(&crit_capture_); 168 rtc::CritScope cs_capture(&crit_capture_);
169 169
170 public_submodules_->echo_cancellation.reset( 170 public_submodules_->echo_cancellation.reset(
171 new EchoCancellationImpl(this, &crit_render_, &crit_capture_)); 171 new EchoCancellationImpl(&crit_render_, &crit_capture_));
172 public_submodules_->echo_control_mobile.reset( 172 public_submodules_->echo_control_mobile.reset(
173 new EchoControlMobileImpl(&crit_render_, &crit_capture_)); 173 new EchoControlMobileImpl(&crit_render_, &crit_capture_));
174 public_submodules_->gain_control.reset( 174 public_submodules_->gain_control.reset(
175 new GainControlImpl(&crit_capture_, &crit_capture_)); 175 new GainControlImpl(&crit_capture_, &crit_capture_));
176 public_submodules_->high_pass_filter.reset( 176 public_submodules_->high_pass_filter.reset(
177 new HighPassFilterImpl(&crit_capture_)); 177 new HighPassFilterImpl(&crit_capture_));
178 public_submodules_->level_estimator.reset( 178 public_submodules_->level_estimator.reset(
179 new LevelEstimatorImpl(&crit_capture_)); 179 new LevelEstimatorImpl(&crit_capture_));
180 public_submodules_->noise_suppression.reset( 180 public_submodules_->noise_suppression.reset(
181 new NoiseSuppressionImpl(&crit_capture_)); 181 new NoiseSuppressionImpl(&crit_capture_));
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(), 651 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(),
652 &debug_dump_.num_bytes_left_for_log_, 652 &debug_dump_.num_bytes_left_for_log_,
653 &crit_debug_, &debug_dump_.capture)); 653 &crit_debug_, &debug_dump_.capture));
654 } 654 }
655 #endif 655 #endif
656 656
657 return kNoError; 657 return kNoError;
658 } 658 }
659 659
660 int AudioProcessingImpl::ProcessStreamLocked() { 660 int AudioProcessingImpl::ProcessStreamLocked() {
661 // Ensure that not both the AEC and AECM are active at the same time.
662 // TODO(peah): Simplify once the public API Enable functions for these
663 // are moved to APM.
664 RTC_DCHECK(!(public_submodules_->echo_cancellation->is_enabled() &&
665 public_submodules_->echo_control_mobile->is_enabled()));
666
661 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP 667 #ifdef WEBRTC_AUDIOPROC_DEBUG_DUMP
662 if (debug_dump_.debug_file->Open()) { 668 if (debug_dump_.debug_file->Open()) {
663 audioproc::Stream* msg = debug_dump_.capture.event_msg->mutable_stream(); 669 audioproc::Stream* msg = debug_dump_.capture.event_msg->mutable_stream();
664 msg->set_delay(capture_nonlocked_.stream_delay_ms); 670 msg->set_delay(capture_nonlocked_.stream_delay_ms);
665 msg->set_drift( 671 msg->set_drift(
666 public_submodules_->echo_cancellation->stream_drift_samples()); 672 public_submodules_->echo_cancellation->stream_drift_samples());
667 msg->set_level(gain_control()->stream_analog_level()); 673 msg->set_level(gain_control()->stream_analog_level());
668 msg->set_keypress(capture_.key_pressed); 674 msg->set_keypress(capture_.key_pressed);
669 } 675 }
670 #endif 676 #endif
(...skipping 16 matching lines...) Expand all
687 693
688 if (capture_nonlocked_.beamformer_enabled) { 694 if (capture_nonlocked_.beamformer_enabled) {
689 private_submodules_->beamformer->ProcessChunk(*ca->split_data_f(), 695 private_submodules_->beamformer->ProcessChunk(*ca->split_data_f(),
690 ca->split_data_f()); 696 ca->split_data_f());
691 ca->set_num_channels(1); 697 ca->set_num_channels(1);
692 } 698 }
693 699
694 public_submodules_->high_pass_filter->ProcessCaptureAudio(ca); 700 public_submodules_->high_pass_filter->ProcessCaptureAudio(ca);
695 RETURN_ON_ERR(public_submodules_->gain_control->AnalyzeCaptureAudio(ca)); 701 RETURN_ON_ERR(public_submodules_->gain_control->AnalyzeCaptureAudio(ca));
696 public_submodules_->noise_suppression->AnalyzeCaptureAudio(ca); 702 public_submodules_->noise_suppression->AnalyzeCaptureAudio(ca);
697 RETURN_ON_ERR(public_submodules_->echo_cancellation->ProcessCaptureAudio(ca)); 703
704 // Ensure that the stream delay was set before the call to the
705 // AEC ProcessCaptureAudio function.
706 if (public_submodules_->echo_cancellation->is_enabled() &&
707 !was_stream_delay_set()) {
708 return AudioProcessing::kStreamParameterNotSetError;
709 }
710
711 RETURN_ON_ERR(public_submodules_->echo_cancellation->ProcessCaptureAudio(
712 ca, stream_delay_ms()));
698 713
699 if (public_submodules_->echo_control_mobile->is_enabled() && 714 if (public_submodules_->echo_control_mobile->is_enabled() &&
700 public_submodules_->noise_suppression->is_enabled()) { 715 public_submodules_->noise_suppression->is_enabled()) {
701 ca->CopyLowPassToReference(); 716 ca->CopyLowPassToReference();
702 } 717 }
703 public_submodules_->noise_suppression->ProcessCaptureAudio(ca); 718 public_submodules_->noise_suppression->ProcessCaptureAudio(ca);
704 if (constants_.intelligibility_enabled) { 719 if (constants_.intelligibility_enabled) {
705 RTC_DCHECK(public_submodules_->noise_suppression->is_enabled()); 720 RTC_DCHECK(public_submodules_->noise_suppression->is_enabled());
706 public_submodules_->intelligibility_enhancer->SetCaptureNoiseEstimate( 721 public_submodules_->intelligibility_enhancer->SetCaptureNoiseEstimate(
707 public_submodules_->noise_suppression->NoiseEstimate()); 722 public_submodules_->noise_suppression->NoiseEstimate());
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
1220 public_submodules_->high_pass_filter->Initialize(num_proc_channels(), 1235 public_submodules_->high_pass_filter->Initialize(num_proc_channels(),
1221 proc_sample_rate_hz()); 1236 proc_sample_rate_hz());
1222 } 1237 }
1223 1238
1224 void AudioProcessingImpl::InitializeNoiseSuppression() { 1239 void AudioProcessingImpl::InitializeNoiseSuppression() {
1225 public_submodules_->noise_suppression->Initialize(num_proc_channels(), 1240 public_submodules_->noise_suppression->Initialize(num_proc_channels(),
1226 proc_sample_rate_hz()); 1241 proc_sample_rate_hz());
1227 } 1242 }
1228 1243
1229 void AudioProcessingImpl::InitializeEchoCanceller() { 1244 void AudioProcessingImpl::InitializeEchoCanceller() {
1230 public_submodules_->echo_cancellation->Initialize(); 1245 public_submodules_->echo_cancellation->Initialize(
1246 proc_sample_rate_hz(), num_reverse_channels(), num_output_channels(),
1247 num_proc_channels());
1231 } 1248 }
1232 1249
1233 void AudioProcessingImpl::InitializeGainController() { 1250 void AudioProcessingImpl::InitializeGainController() {
1234 public_submodules_->gain_control->Initialize(num_proc_channels(), 1251 public_submodules_->gain_control->Initialize(num_proc_channels(),
1235 proc_sample_rate_hz()); 1252 proc_sample_rate_hz());
1236 } 1253 }
1237 1254
1238 void AudioProcessingImpl::InitializeEchoControlMobile() { 1255 void AudioProcessingImpl::InitializeEchoControlMobile() {
1239 public_submodules_->echo_control_mobile->Initialize( 1256 public_submodules_->echo_control_mobile->Initialize(
1240 proc_sample_rate_hz(), num_reverse_channels(), num_output_channels()); 1257 proc_sample_rate_hz(), num_reverse_channels(), num_output_channels());
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
1442 debug_dump_.capture.event_msg->mutable_config()->CopyFrom(config); 1459 debug_dump_.capture.event_msg->mutable_config()->CopyFrom(config);
1443 1460
1444 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(), 1461 RETURN_ON_ERR(WriteMessageToDebugFile(debug_dump_.debug_file.get(),
1445 &debug_dump_.num_bytes_left_for_log_, 1462 &debug_dump_.num_bytes_left_for_log_,
1446 &crit_debug_, &debug_dump_.capture)); 1463 &crit_debug_, &debug_dump_.capture));
1447 return kNoError; 1464 return kNoError;
1448 } 1465 }
1449 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP 1466 #endif // WEBRTC_AUDIOPROC_DEBUG_DUMP
1450 1467
1451 } // namespace webrtc 1468 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/audio_processing/echo_cancellation_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698