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

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

Issue 1700703005: Boilerplate code addition in order to be able to test upcoming AEC additions (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 10 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 crit_capture_(crit_capture), 70 crit_capture_(crit_capture),
71 drift_compensation_enabled_(false), 71 drift_compensation_enabled_(false),
72 metrics_enabled_(false), 72 metrics_enabled_(false),
73 suppression_level_(kModerateSuppression), 73 suppression_level_(kModerateSuppression),
74 stream_drift_samples_(0), 74 stream_drift_samples_(0),
75 was_stream_drift_set_(false), 75 was_stream_drift_set_(false),
76 stream_has_echo_(false), 76 stream_has_echo_(false),
77 delay_logging_enabled_(false), 77 delay_logging_enabled_(false),
78 extended_filter_enabled_(false), 78 extended_filter_enabled_(false),
79 delay_agnostic_enabled_(false), 79 delay_agnostic_enabled_(false),
80 next_generation_aec_enabled_(false),
80 render_queue_element_max_size_(0) { 81 render_queue_element_max_size_(0) {
81 RTC_DCHECK(apm); 82 RTC_DCHECK(apm);
82 RTC_DCHECK(crit_render); 83 RTC_DCHECK(crit_render);
83 RTC_DCHECK(crit_capture); 84 RTC_DCHECK(crit_capture);
84 } 85 }
85 86
86 EchoCancellationImpl::~EchoCancellationImpl() {} 87 EchoCancellationImpl::~EchoCancellationImpl() {}
87 88
88 int EchoCancellationImpl::ProcessRenderAudio(const AudioBuffer* audio) { 89 int EchoCancellationImpl::ProcessRenderAudio(const AudioBuffer* audio) {
89 rtc::CritScope cs_render(crit_render_); 90 rtc::CritScope cs_render(crit_render_);
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 bool EchoCancellationImpl::is_delay_logging_enabled() const { 350 bool EchoCancellationImpl::is_delay_logging_enabled() const {
350 rtc::CritScope cs(crit_capture_); 351 rtc::CritScope cs(crit_capture_);
351 return delay_logging_enabled_; 352 return delay_logging_enabled_;
352 } 353 }
353 354
354 bool EchoCancellationImpl::is_delay_agnostic_enabled() const { 355 bool EchoCancellationImpl::is_delay_agnostic_enabled() const {
355 rtc::CritScope cs(crit_capture_); 356 rtc::CritScope cs(crit_capture_);
356 return delay_agnostic_enabled_; 357 return delay_agnostic_enabled_;
357 } 358 }
358 359
360 bool EchoCancellationImpl::is_next_generation_aec_enabled() const {
361 rtc::CritScope cs(crit_capture_);
362 return next_generation_aec_enabled_;
363 }
364
359 bool EchoCancellationImpl::is_extended_filter_enabled() const { 365 bool EchoCancellationImpl::is_extended_filter_enabled() const {
360 rtc::CritScope cs(crit_capture_); 366 rtc::CritScope cs(crit_capture_);
361 return extended_filter_enabled_; 367 return extended_filter_enabled_;
362 } 368 }
363 369
364 // TODO(bjornv): How should we handle the multi-channel case? 370 // TODO(bjornv): How should we handle the multi-channel case?
365 int EchoCancellationImpl::GetDelayMetrics(int* median, int* std) { 371 int EchoCancellationImpl::GetDelayMetrics(int* median, int* std) {
366 rtc::CritScope cs(crit_capture_); 372 rtc::CritScope cs(crit_capture_);
367 float fraction_poor_delays = 0; 373 float fraction_poor_delays = 0;
368 return GetDelayMetrics(median, std, &fraction_poor_delays); 374 return GetDelayMetrics(median, std, &fraction_poor_delays);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 } else { 446 } else {
441 render_signal_queue_->Clear(); 447 render_signal_queue_->Clear();
442 } 448 }
443 } 449 }
444 450
445 void EchoCancellationImpl::SetExtraOptions(const Config& config) { 451 void EchoCancellationImpl::SetExtraOptions(const Config& config) {
446 { 452 {
447 rtc::CritScope cs(crit_capture_); 453 rtc::CritScope cs(crit_capture_);
448 extended_filter_enabled_ = config.Get<ExtendedFilter>().enabled; 454 extended_filter_enabled_ = config.Get<ExtendedFilter>().enabled;
449 delay_agnostic_enabled_ = config.Get<DelayAgnostic>().enabled; 455 delay_agnostic_enabled_ = config.Get<DelayAgnostic>().enabled;
456 next_generation_aec_enabled_ = config.Get<NextGenerationAec>().enabled;
450 } 457 }
451 Configure(); 458 Configure();
452 } 459 }
453 460
454 void* EchoCancellationImpl::CreateHandle() const { 461 void* EchoCancellationImpl::CreateHandle() const {
455 return WebRtcAec_Create(); 462 return WebRtcAec_Create();
456 } 463 }
457 464
458 void EchoCancellationImpl::DestroyHandle(void* handle) const { 465 void EchoCancellationImpl::DestroyHandle(void* handle) const {
459 assert(handle != NULL); 466 assert(handle != NULL);
(...skipping 19 matching lines...) Expand all
479 config.metricsMode = metrics_enabled_; 486 config.metricsMode = metrics_enabled_;
480 config.nlpMode = MapSetting(suppression_level_); 487 config.nlpMode = MapSetting(suppression_level_);
481 config.skewMode = drift_compensation_enabled_; 488 config.skewMode = drift_compensation_enabled_;
482 config.delay_logging = delay_logging_enabled_; 489 config.delay_logging = delay_logging_enabled_;
483 WebRtcAec_enable_extended_filter( 490 WebRtcAec_enable_extended_filter(
484 WebRtcAec_aec_core(static_cast<Handle*>(handle)), 491 WebRtcAec_aec_core(static_cast<Handle*>(handle)),
485 extended_filter_enabled_ ? 1 : 0); 492 extended_filter_enabled_ ? 1 : 0);
486 WebRtcAec_enable_delay_agnostic( 493 WebRtcAec_enable_delay_agnostic(
487 WebRtcAec_aec_core(static_cast<Handle*>(handle)), 494 WebRtcAec_aec_core(static_cast<Handle*>(handle)),
488 delay_agnostic_enabled_ ? 1 : 0); 495 delay_agnostic_enabled_ ? 1 : 0);
496 WebRtcAec_enable_next_generation_aec(
497 WebRtcAec_aec_core(static_cast<Handle*>(handle)),
498 next_generation_aec_enabled_ ? 1 : 0);
489 return WebRtcAec_set_config(static_cast<Handle*>(handle), config); 499 return WebRtcAec_set_config(static_cast<Handle*>(handle), config);
490 } 500 }
491 501
492 size_t EchoCancellationImpl::num_handles_required() const { 502 size_t EchoCancellationImpl::num_handles_required() const {
493 // Not locked as it only relies on APM public API which is threadsafe. 503 // Not locked as it only relies on APM public API which is threadsafe.
494 return apm_->num_output_channels() * apm_->num_reverse_channels(); 504 return apm_->num_output_channels() * apm_->num_reverse_channels();
495 } 505 }
496 506
497 int EchoCancellationImpl::GetHandleError(void* handle) const { 507 int EchoCancellationImpl::GetHandleError(void* handle) const {
498 // Not locked as it does not rely on anything in the state. 508 // Not locked as it does not rely on anything in the state.
499 assert(handle != NULL); 509 assert(handle != NULL);
500 return AudioProcessing::kUnspecifiedError; 510 return AudioProcessing::kUnspecifiedError;
501 } 511 }
502 } // namespace webrtc 512 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698