OLD | NEW |
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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 std::string EchoCancellationImpl::GetExperimentsDescription() { | 416 std::string EchoCancellationImpl::GetExperimentsDescription() { |
417 rtc::CritScope cs(crit_capture_); | 417 rtc::CritScope cs(crit_capture_); |
418 return aec3_enabled_ ? "AEC3" : ""; | 418 std::string description = (aec3_enabled_ ? "AEC3" : ""); |
| 419 if (refined_adaptive_filter_enabled_) { |
| 420 description += ";RefinedAdaptiveFilter"; |
| 421 } |
| 422 return description; |
| 423 } |
| 424 |
| 425 bool EchoCancellationImpl::is_refined_adaptive_filter_enabled() const { |
| 426 rtc::CritScope cs(crit_capture_); |
| 427 return refined_adaptive_filter_enabled_; |
419 } | 428 } |
420 | 429 |
421 bool EchoCancellationImpl::is_extended_filter_enabled() const { | 430 bool EchoCancellationImpl::is_extended_filter_enabled() const { |
422 rtc::CritScope cs(crit_capture_); | 431 rtc::CritScope cs(crit_capture_); |
423 return extended_filter_enabled_; | 432 return extended_filter_enabled_; |
424 } | 433 } |
425 | 434 |
426 // TODO(bjornv): How should we handle the multi-channel case? | 435 // TODO(bjornv): How should we handle the multi-channel case? |
427 int EchoCancellationImpl::GetDelayMetrics(int* median, int* std) { | 436 int EchoCancellationImpl::GetDelayMetrics(int* median, int* std) { |
428 rtc::CritScope cs(crit_capture_); | 437 rtc::CritScope cs(crit_capture_); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 } else { | 536 } else { |
528 render_signal_queue_->Clear(); | 537 render_signal_queue_->Clear(); |
529 } | 538 } |
530 } | 539 } |
531 | 540 |
532 void EchoCancellationImpl::SetExtraOptions(const Config& config) { | 541 void EchoCancellationImpl::SetExtraOptions(const Config& config) { |
533 { | 542 { |
534 rtc::CritScope cs(crit_capture_); | 543 rtc::CritScope cs(crit_capture_); |
535 extended_filter_enabled_ = config.Get<ExtendedFilter>().enabled; | 544 extended_filter_enabled_ = config.Get<ExtendedFilter>().enabled; |
536 delay_agnostic_enabled_ = config.Get<DelayAgnostic>().enabled; | 545 delay_agnostic_enabled_ = config.Get<DelayAgnostic>().enabled; |
| 546 refined_adaptive_filter_enabled_ = |
| 547 config.Get<RefinedAdaptiveFilter>().enabled; |
537 aec3_enabled_ = config.Get<EchoCanceller3>().enabled; | 548 aec3_enabled_ = config.Get<EchoCanceller3>().enabled; |
538 } | 549 } |
539 Configure(); | 550 Configure(); |
540 } | 551 } |
541 | 552 |
542 int EchoCancellationImpl::Configure() { | 553 int EchoCancellationImpl::Configure() { |
543 rtc::CritScope cs_render(crit_render_); | 554 rtc::CritScope cs_render(crit_render_); |
544 rtc::CritScope cs_capture(crit_capture_); | 555 rtc::CritScope cs_capture(crit_capture_); |
545 AecConfig config; | 556 AecConfig config; |
546 config.metricsMode = metrics_enabled_; | 557 config.metricsMode = metrics_enabled_; |
547 config.nlpMode = MapSetting(suppression_level_); | 558 config.nlpMode = MapSetting(suppression_level_); |
548 config.skewMode = drift_compensation_enabled_; | 559 config.skewMode = drift_compensation_enabled_; |
549 config.delay_logging = delay_logging_enabled_; | 560 config.delay_logging = delay_logging_enabled_; |
550 | 561 |
551 int error = AudioProcessing::kNoError; | 562 int error = AudioProcessing::kNoError; |
552 for (auto& canceller : cancellers_) { | 563 for (auto& canceller : cancellers_) { |
553 WebRtcAec_enable_extended_filter(WebRtcAec_aec_core(canceller->state()), | 564 WebRtcAec_enable_extended_filter(WebRtcAec_aec_core(canceller->state()), |
554 extended_filter_enabled_ ? 1 : 0); | 565 extended_filter_enabled_ ? 1 : 0); |
555 WebRtcAec_enable_delay_agnostic(WebRtcAec_aec_core(canceller->state()), | 566 WebRtcAec_enable_delay_agnostic(WebRtcAec_aec_core(canceller->state()), |
556 delay_agnostic_enabled_ ? 1 : 0); | 567 delay_agnostic_enabled_ ? 1 : 0); |
557 WebRtcAec_enable_aec3(WebRtcAec_aec_core(canceller->state()), | 568 WebRtcAec_enable_aec3(WebRtcAec_aec_core(canceller->state()), |
558 aec3_enabled_ ? 1 : 0); | 569 aec3_enabled_ ? 1 : 0); |
| 570 WebRtcAec_enable_refined_adaptive_filter( |
| 571 WebRtcAec_aec_core(canceller->state()), |
| 572 refined_adaptive_filter_enabled_); |
559 const int handle_error = WebRtcAec_set_config(canceller->state(), config); | 573 const int handle_error = WebRtcAec_set_config(canceller->state(), config); |
560 if (handle_error != AudioProcessing::kNoError) { | 574 if (handle_error != AudioProcessing::kNoError) { |
561 error = AudioProcessing::kNoError; | 575 error = AudioProcessing::kNoError; |
562 } | 576 } |
563 } | 577 } |
564 return error; | 578 return error; |
565 } | 579 } |
566 | 580 |
567 size_t EchoCancellationImpl::NumCancellersRequired() const { | 581 size_t EchoCancellationImpl::NumCancellersRequired() const { |
568 RTC_DCHECK(stream_properties_); | 582 RTC_DCHECK(stream_properties_); |
569 return stream_properties_->num_output_channels * | 583 return stream_properties_->num_output_channels * |
570 stream_properties_->num_reverse_channels; | 584 stream_properties_->num_reverse_channels; |
571 } | 585 } |
572 | 586 |
573 } // namespace webrtc | 587 } // namespace webrtc |
OLD | NEW |