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

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

Issue 1166463006: Revert r9378 "Rename APM Config DelayCorrection to ExtendedFilter" (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 6 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 // AEC_UNSPECIFIED_ERROR 50 // AEC_UNSPECIFIED_ERROR
51 // AEC_UNINITIALIZED_ERROR 51 // AEC_UNINITIALIZED_ERROR
52 // AEC_NULL_POINTER_ERROR 52 // AEC_NULL_POINTER_ERROR
53 return AudioProcessing::kUnspecifiedError; 53 return AudioProcessing::kUnspecifiedError;
54 } 54 }
55 } 55 }
56 } // namespace 56 } // namespace
57 57
58 EchoCancellationImpl::EchoCancellationImpl(const AudioProcessing* apm, 58 EchoCancellationImpl::EchoCancellationImpl(const AudioProcessing* apm,
59 CriticalSectionWrapper* crit) 59 CriticalSectionWrapper* crit)
60 : ProcessingComponent(), 60 : ProcessingComponent(),
61 apm_(apm), 61 apm_(apm),
62 crit_(crit), 62 crit_(crit),
63 drift_compensation_enabled_(false), 63 drift_compensation_enabled_(false),
64 metrics_enabled_(false), 64 metrics_enabled_(false),
65 suppression_level_(kModerateSuppression), 65 suppression_level_(kModerateSuppression),
66 stream_drift_samples_(0), 66 stream_drift_samples_(0),
67 was_stream_drift_set_(false), 67 was_stream_drift_set_(false),
68 stream_has_echo_(false), 68 stream_has_echo_(false),
69 delay_logging_enabled_(false), 69 delay_logging_enabled_(false),
70 extended_filter_enabled_(false), 70 delay_correction_enabled_(false),
71 reported_delay_enabled_(true) { 71 reported_delay_enabled_(true) {}
72 }
73 72
74 EchoCancellationImpl::~EchoCancellationImpl() {} 73 EchoCancellationImpl::~EchoCancellationImpl() {}
75 74
76 int EchoCancellationImpl::ProcessRenderAudio(const AudioBuffer* audio) { 75 int EchoCancellationImpl::ProcessRenderAudio(const AudioBuffer* audio) {
77 if (!is_component_enabled()) { 76 if (!is_component_enabled()) {
78 return apm_->kNoError; 77 return apm_->kNoError;
79 } 78 }
80 79
81 assert(audio->num_frames_per_band() <= 160); 80 assert(audio->num_frames_per_band() <= 160);
82 assert(audio->num_channels() == apm_->num_reverse_channels()); 81 assert(audio->num_channels() == apm_->num_reverse_channels());
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 int EchoCancellationImpl::Initialize() { 320 int EchoCancellationImpl::Initialize() {
322 int err = ProcessingComponent::Initialize(); 321 int err = ProcessingComponent::Initialize();
323 if (err != apm_->kNoError || !is_component_enabled()) { 322 if (err != apm_->kNoError || !is_component_enabled()) {
324 return err; 323 return err;
325 } 324 }
326 325
327 return apm_->kNoError; 326 return apm_->kNoError;
328 } 327 }
329 328
330 void EchoCancellationImpl::SetExtraOptions(const Config& config) { 329 void EchoCancellationImpl::SetExtraOptions(const Config& config) {
331 // Both ExtendedFilter and DelayCorrection are diabled by default. If any one 330 delay_correction_enabled_ = config.Get<DelayCorrection>().enabled;
332 // of them is true, then the extended filter mode is enabled.
333 extended_filter_enabled_ = config.Get<ExtendedFilter>().enabled ||
334 config.Get<DelayCorrection>().enabled;
335 reported_delay_enabled_ = config.Get<ReportedDelay>().enabled; 331 reported_delay_enabled_ = config.Get<ReportedDelay>().enabled;
336 Configure(); 332 Configure();
337 } 333 }
338 334
339 void* EchoCancellationImpl::CreateHandle() const { 335 void* EchoCancellationImpl::CreateHandle() const {
340 Handle* handle = NULL; 336 Handle* handle = NULL;
341 if (WebRtcAec_Create(&handle) != apm_->kNoError) { 337 if (WebRtcAec_Create(&handle) != apm_->kNoError) {
342 handle = NULL; 338 handle = NULL;
343 } else { 339 } else {
344 assert(handle != NULL); 340 assert(handle != NULL);
(...skipping 18 matching lines...) Expand all
363 } 359 }
364 360
365 int EchoCancellationImpl::ConfigureHandle(void* handle) const { 361 int EchoCancellationImpl::ConfigureHandle(void* handle) const {
366 assert(handle != NULL); 362 assert(handle != NULL);
367 AecConfig config; 363 AecConfig config;
368 config.metricsMode = metrics_enabled_; 364 config.metricsMode = metrics_enabled_;
369 config.nlpMode = MapSetting(suppression_level_); 365 config.nlpMode = MapSetting(suppression_level_);
370 config.skewMode = drift_compensation_enabled_; 366 config.skewMode = drift_compensation_enabled_;
371 config.delay_logging = delay_logging_enabled_; 367 config.delay_logging = delay_logging_enabled_;
372 368
373 WebRtcAec_enable_extended_filter( 369 WebRtcAec_enable_delay_correction(WebRtcAec_aec_core(
374 WebRtcAec_aec_core(static_cast<Handle*>(handle)), 370 static_cast<Handle*>(handle)), delay_correction_enabled_ ? 1 : 0);
375 extended_filter_enabled_ ? 1 : 0);
376 WebRtcAec_enable_reported_delay(WebRtcAec_aec_core( 371 WebRtcAec_enable_reported_delay(WebRtcAec_aec_core(
377 static_cast<Handle*>(handle)), reported_delay_enabled_ ? 1 : 0); 372 static_cast<Handle*>(handle)), reported_delay_enabled_ ? 1 : 0);
378 return WebRtcAec_set_config(static_cast<Handle*>(handle), config); 373 return WebRtcAec_set_config(static_cast<Handle*>(handle), config);
379 } 374 }
380 375
381 int EchoCancellationImpl::num_handles_required() const { 376 int EchoCancellationImpl::num_handles_required() const {
382 return apm_->num_output_channels() * 377 return apm_->num_output_channels() *
383 apm_->num_reverse_channels(); 378 apm_->num_reverse_channels();
384 } 379 }
385 380
386 int EchoCancellationImpl::GetHandleError(void* handle) const { 381 int EchoCancellationImpl::GetHandleError(void* handle) const {
387 assert(handle != NULL); 382 assert(handle != NULL);
388 return MapError(WebRtcAec_get_error_code(static_cast<Handle*>(handle))); 383 return MapError(WebRtcAec_get_error_code(static_cast<Handle*>(handle)));
389 } 384 }
390 } // namespace webrtc 385 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698