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

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

Issue 1887003002: Added support in the AEC for refined filter adaptation. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Corrected the issue with the missing const specifier in the header file Created 4 years, 8 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 395 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 bool EchoCancellationImpl::is_delay_agnostic_enabled() const { 406 bool EchoCancellationImpl::is_delay_agnostic_enabled() const {
407 rtc::CritScope cs(crit_capture_); 407 rtc::CritScope cs(crit_capture_);
408 return delay_agnostic_enabled_; 408 return delay_agnostic_enabled_;
409 } 409 }
410 410
411 bool EchoCancellationImpl::is_aec3_enabled() const { 411 bool EchoCancellationImpl::is_aec3_enabled() const {
412 rtc::CritScope cs(crit_capture_); 412 rtc::CritScope cs(crit_capture_);
413 return aec3_enabled_; 413 return aec3_enabled_;
414 } 414 }
415 415
416 bool EchoCancellationImpl::is_refined_adaptive_filter_enabled() const {
417 rtc::CritScope cs(crit_capture_);
418 return refined_adaptive_filter_enabled_;
419 }
420
416 bool EchoCancellationImpl::is_extended_filter_enabled() const { 421 bool EchoCancellationImpl::is_extended_filter_enabled() const {
417 rtc::CritScope cs(crit_capture_); 422 rtc::CritScope cs(crit_capture_);
418 return extended_filter_enabled_; 423 return extended_filter_enabled_;
419 } 424 }
420 425
421 // TODO(bjornv): How should we handle the multi-channel case? 426 // TODO(bjornv): How should we handle the multi-channel case?
422 int EchoCancellationImpl::GetDelayMetrics(int* median, int* std) { 427 int EchoCancellationImpl::GetDelayMetrics(int* median, int* std) {
423 rtc::CritScope cs(crit_capture_); 428 rtc::CritScope cs(crit_capture_);
424 float fraction_poor_delays = 0; 429 float fraction_poor_delays = 0;
425 return GetDelayMetrics(median, std, &fraction_poor_delays); 430 return GetDelayMetrics(median, std, &fraction_poor_delays);
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 } else { 527 } else {
523 render_signal_queue_->Clear(); 528 render_signal_queue_->Clear();
524 } 529 }
525 } 530 }
526 531
527 void EchoCancellationImpl::SetExtraOptions(const Config& config) { 532 void EchoCancellationImpl::SetExtraOptions(const Config& config) {
528 { 533 {
529 rtc::CritScope cs(crit_capture_); 534 rtc::CritScope cs(crit_capture_);
530 extended_filter_enabled_ = config.Get<ExtendedFilter>().enabled; 535 extended_filter_enabled_ = config.Get<ExtendedFilter>().enabled;
531 delay_agnostic_enabled_ = config.Get<DelayAgnostic>().enabled; 536 delay_agnostic_enabled_ = config.Get<DelayAgnostic>().enabled;
537 refined_adaptive_filter_enabled_ =
538 config.Get<RefinedAdaptiveFilter>().enabled;
532 aec3_enabled_ = config.Get<EchoCanceller3>().enabled; 539 aec3_enabled_ = config.Get<EchoCanceller3>().enabled;
533 } 540 }
534 Configure(); 541 Configure();
535 } 542 }
536 543
537 int EchoCancellationImpl::Configure() { 544 int EchoCancellationImpl::Configure() {
538 rtc::CritScope cs_render(crit_render_); 545 rtc::CritScope cs_render(crit_render_);
539 rtc::CritScope cs_capture(crit_capture_); 546 rtc::CritScope cs_capture(crit_capture_);
540 AecConfig config; 547 AecConfig config;
541 config.metricsMode = metrics_enabled_; 548 config.metricsMode = metrics_enabled_;
542 config.nlpMode = MapSetting(suppression_level_); 549 config.nlpMode = MapSetting(suppression_level_);
543 config.skewMode = drift_compensation_enabled_; 550 config.skewMode = drift_compensation_enabled_;
544 config.delay_logging = delay_logging_enabled_; 551 config.delay_logging = delay_logging_enabled_;
545 552
546 int error = AudioProcessing::kNoError; 553 int error = AudioProcessing::kNoError;
547 for (auto& canceller : cancellers_) { 554 for (auto& canceller : cancellers_) {
548 WebRtcAec_enable_extended_filter(WebRtcAec_aec_core(canceller->state()), 555 WebRtcAec_enable_extended_filter(WebRtcAec_aec_core(canceller->state()),
549 extended_filter_enabled_ ? 1 : 0); 556 extended_filter_enabled_ ? 1 : 0);
550 WebRtcAec_enable_delay_agnostic(WebRtcAec_aec_core(canceller->state()), 557 WebRtcAec_enable_delay_agnostic(WebRtcAec_aec_core(canceller->state()),
551 delay_agnostic_enabled_ ? 1 : 0); 558 delay_agnostic_enabled_ ? 1 : 0);
552 WebRtcAec_enable_aec3(WebRtcAec_aec_core(canceller->state()), 559 WebRtcAec_enable_aec3(WebRtcAec_aec_core(canceller->state()),
553 aec3_enabled_ ? 1 : 0); 560 aec3_enabled_ ? 1 : 0);
561 WebRtcAec_enable_refined_adaptive_filter(
562 WebRtcAec_aec_core(canceller->state()),
563 refined_adaptive_filter_enabled_);
554 const int handle_error = WebRtcAec_set_config(canceller->state(), config); 564 const int handle_error = WebRtcAec_set_config(canceller->state(), config);
555 if (handle_error != AudioProcessing::kNoError) { 565 if (handle_error != AudioProcessing::kNoError) {
556 error = AudioProcessing::kNoError; 566 error = AudioProcessing::kNoError;
557 } 567 }
558 } 568 }
559 return error; 569 return error;
560 } 570 }
561 571
562 size_t EchoCancellationImpl::NumCancellersRequired() const { 572 size_t EchoCancellationImpl::NumCancellersRequired() const {
563 RTC_DCHECK(stream_properties_); 573 RTC_DCHECK(stream_properties_);
564 return stream_properties_->num_output_channels * 574 return stream_properties_->num_output_channels *
565 stream_properties_->num_reverse_channels; 575 stream_properties_->num_reverse_channels;
566 } 576 }
567 577
568 } // namespace webrtc 578 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698