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

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

Issue 2567513003: Added basic framework for AEC3 in the audio processing module (Closed)
Patch Set: Created 4 years 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 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 bool EchoCancellationImpl::is_delay_logging_enabled() const { 334 bool EchoCancellationImpl::is_delay_logging_enabled() const {
335 rtc::CritScope cs(crit_capture_); 335 rtc::CritScope cs(crit_capture_);
336 return enabled_ && delay_logging_enabled_; 336 return enabled_ && delay_logging_enabled_;
337 } 337 }
338 338
339 bool EchoCancellationImpl::is_delay_agnostic_enabled() const { 339 bool EchoCancellationImpl::is_delay_agnostic_enabled() const {
340 rtc::CritScope cs(crit_capture_); 340 rtc::CritScope cs(crit_capture_);
341 return delay_agnostic_enabled_; 341 return delay_agnostic_enabled_;
342 } 342 }
343 343
344 bool EchoCancellationImpl::is_aec3_enabled() const {
345 rtc::CritScope cs(crit_capture_);
346 return aec3_enabled_;
347 }
348
349 std::string EchoCancellationImpl::GetExperimentsDescription() { 344 std::string EchoCancellationImpl::GetExperimentsDescription() {
350 rtc::CritScope cs(crit_capture_); 345 rtc::CritScope cs(crit_capture_);
351 std::string description = (aec3_enabled_ ? "AEC3;" : ""); 346 std::string description = "";
aleloi 2016/12/09 13:30:04 Maybe change body to ternary operator one-liner?
peah-webrtc 2016/12/12 19:46:46 Good point! Done.
352 if (refined_adaptive_filter_enabled_) { 347 if (refined_adaptive_filter_enabled_) {
353 description += "RefinedAdaptiveFilter;"; 348 description += "RefinedAdaptiveFilter;";
354 } 349 }
355 return description; 350 return description;
356 } 351 }
357 352
358 bool EchoCancellationImpl::is_refined_adaptive_filter_enabled() const { 353 bool EchoCancellationImpl::is_refined_adaptive_filter_enabled() const {
359 rtc::CritScope cs(crit_capture_); 354 rtc::CritScope cs(crit_capture_);
360 return refined_adaptive_filter_enabled_; 355 return refined_adaptive_filter_enabled_;
361 } 356 }
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 } 461 }
467 } 462 }
468 463
469 void EchoCancellationImpl::SetExtraOptions(const webrtc::Config& config) { 464 void EchoCancellationImpl::SetExtraOptions(const webrtc::Config& config) {
470 { 465 {
471 rtc::CritScope cs(crit_capture_); 466 rtc::CritScope cs(crit_capture_);
472 extended_filter_enabled_ = config.Get<ExtendedFilter>().enabled; 467 extended_filter_enabled_ = config.Get<ExtendedFilter>().enabled;
473 delay_agnostic_enabled_ = config.Get<DelayAgnostic>().enabled; 468 delay_agnostic_enabled_ = config.Get<DelayAgnostic>().enabled;
474 refined_adaptive_filter_enabled_ = 469 refined_adaptive_filter_enabled_ =
475 config.Get<RefinedAdaptiveFilter>().enabled; 470 config.Get<RefinedAdaptiveFilter>().enabled;
476 aec3_enabled_ = config.Get<EchoCanceller3>().enabled;
477 } 471 }
478 Configure(); 472 Configure();
479 } 473 }
480 474
481 int EchoCancellationImpl::Configure() { 475 int EchoCancellationImpl::Configure() {
482 rtc::CritScope cs_render(crit_render_); 476 rtc::CritScope cs_render(crit_render_);
483 rtc::CritScope cs_capture(crit_capture_); 477 rtc::CritScope cs_capture(crit_capture_);
484 AecConfig config; 478 AecConfig config;
485 config.metricsMode = metrics_enabled_; 479 config.metricsMode = metrics_enabled_;
486 config.nlpMode = MapSetting(suppression_level_); 480 config.nlpMode = MapSetting(suppression_level_);
487 config.skewMode = drift_compensation_enabled_; 481 config.skewMode = drift_compensation_enabled_;
488 config.delay_logging = delay_logging_enabled_; 482 config.delay_logging = delay_logging_enabled_;
489 483
490 int error = AudioProcessing::kNoError; 484 int error = AudioProcessing::kNoError;
491 for (auto& canceller : cancellers_) { 485 for (auto& canceller : cancellers_) {
492 WebRtcAec_enable_extended_filter(WebRtcAec_aec_core(canceller->state()), 486 WebRtcAec_enable_extended_filter(WebRtcAec_aec_core(canceller->state()),
493 extended_filter_enabled_ ? 1 : 0); 487 extended_filter_enabled_ ? 1 : 0);
494 WebRtcAec_enable_delay_agnostic(WebRtcAec_aec_core(canceller->state()), 488 WebRtcAec_enable_delay_agnostic(WebRtcAec_aec_core(canceller->state()),
495 delay_agnostic_enabled_ ? 1 : 0); 489 delay_agnostic_enabled_ ? 1 : 0);
496 WebRtcAec_enable_aec3(WebRtcAec_aec_core(canceller->state()),
497 aec3_enabled_ ? 1 : 0);
aleloi 2016/12/09 13:30:04 The member aec3_enabled_ is not used any longer, s
peah-webrtc 2016/12/12 19:46:46 Done.
498 WebRtcAec_enable_refined_adaptive_filter( 490 WebRtcAec_enable_refined_adaptive_filter(
499 WebRtcAec_aec_core(canceller->state()), 491 WebRtcAec_aec_core(canceller->state()),
500 refined_adaptive_filter_enabled_); 492 refined_adaptive_filter_enabled_);
501 const int handle_error = WebRtcAec_set_config(canceller->state(), config); 493 const int handle_error = WebRtcAec_set_config(canceller->state(), config);
502 if (handle_error != AudioProcessing::kNoError) { 494 if (handle_error != AudioProcessing::kNoError) {
503 error = AudioProcessing::kNoError; 495 error = AudioProcessing::kNoError;
504 } 496 }
505 } 497 }
506 return error; 498 return error;
507 } 499 }
508 500
509 size_t EchoCancellationImpl::NumCancellersRequired( 501 size_t EchoCancellationImpl::NumCancellersRequired(
510 size_t num_output_channels, 502 size_t num_output_channels,
511 size_t num_reverse_channels) { 503 size_t num_reverse_channels) {
512 return num_output_channels * num_reverse_channels; 504 return num_output_channels * num_reverse_channels;
513 } 505 }
514 506
515 } // namespace webrtc 507 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698