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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 extended_filter_enabled_(false), |
71 reported_delay_enabled_(true) { | 71 delay_agnostic_enabled_(false) { |
72 } | 72 } |
73 | 73 |
74 EchoCancellationImpl::~EchoCancellationImpl() {} | 74 EchoCancellationImpl::~EchoCancellationImpl() {} |
75 | 75 |
76 int EchoCancellationImpl::ProcessRenderAudio(const AudioBuffer* audio) { | 76 int EchoCancellationImpl::ProcessRenderAudio(const AudioBuffer* audio) { |
77 if (!is_component_enabled()) { | 77 if (!is_component_enabled()) { |
78 return apm_->kNoError; | 78 return apm_->kNoError; |
79 } | 79 } |
80 | 80 |
81 assert(audio->num_frames_per_band() <= 160); | 81 assert(audio->num_frames_per_band() <= 160); |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 int err = ProcessingComponent::Initialize(); | 322 int err = ProcessingComponent::Initialize(); |
323 if (err != apm_->kNoError || !is_component_enabled()) { | 323 if (err != apm_->kNoError || !is_component_enabled()) { |
324 return err; | 324 return err; |
325 } | 325 } |
326 | 326 |
327 return apm_->kNoError; | 327 return apm_->kNoError; |
328 } | 328 } |
329 | 329 |
330 void EchoCancellationImpl::SetExtraOptions(const Config& config) { | 330 void EchoCancellationImpl::SetExtraOptions(const Config& config) { |
331 extended_filter_enabled_ = config.Get<ExtendedFilter>().enabled; | 331 extended_filter_enabled_ = config.Get<ExtendedFilter>().enabled; |
332 reported_delay_enabled_ = config.Get<ReportedDelay>().enabled; | 332 delay_agnostic_enabled_ = config.Get<DelayAgnostic>().enabled || |
| 333 !config.Get<ReportedDelay>().enabled; |
333 Configure(); | 334 Configure(); |
334 } | 335 } |
335 | 336 |
336 void* EchoCancellationImpl::CreateHandle() const { | 337 void* EchoCancellationImpl::CreateHandle() const { |
337 return WebRtcAec_Create(); | 338 return WebRtcAec_Create(); |
338 } | 339 } |
339 | 340 |
340 void EchoCancellationImpl::DestroyHandle(void* handle) const { | 341 void EchoCancellationImpl::DestroyHandle(void* handle) const { |
341 assert(handle != NULL); | 342 assert(handle != NULL); |
342 WebRtcAec_Free(static_cast<Handle*>(handle)); | 343 WebRtcAec_Free(static_cast<Handle*>(handle)); |
(...skipping 13 matching lines...) Expand all Loading... |
356 assert(handle != NULL); | 357 assert(handle != NULL); |
357 AecConfig config; | 358 AecConfig config; |
358 config.metricsMode = metrics_enabled_; | 359 config.metricsMode = metrics_enabled_; |
359 config.nlpMode = MapSetting(suppression_level_); | 360 config.nlpMode = MapSetting(suppression_level_); |
360 config.skewMode = drift_compensation_enabled_; | 361 config.skewMode = drift_compensation_enabled_; |
361 config.delay_logging = delay_logging_enabled_; | 362 config.delay_logging = delay_logging_enabled_; |
362 | 363 |
363 WebRtcAec_enable_extended_filter( | 364 WebRtcAec_enable_extended_filter( |
364 WebRtcAec_aec_core(static_cast<Handle*>(handle)), | 365 WebRtcAec_aec_core(static_cast<Handle*>(handle)), |
365 extended_filter_enabled_ ? 1 : 0); | 366 extended_filter_enabled_ ? 1 : 0); |
366 WebRtcAec_enable_reported_delay(WebRtcAec_aec_core( | 367 WebRtcAec_enable_delay_agnostic( |
367 static_cast<Handle*>(handle)), reported_delay_enabled_ ? 1 : 0); | 368 WebRtcAec_aec_core(static_cast<Handle*>(handle)), |
| 369 delay_agnostic_enabled_ ? 1 : 0); |
368 return WebRtcAec_set_config(static_cast<Handle*>(handle), config); | 370 return WebRtcAec_set_config(static_cast<Handle*>(handle), config); |
369 } | 371 } |
370 | 372 |
371 int EchoCancellationImpl::num_handles_required() const { | 373 int EchoCancellationImpl::num_handles_required() const { |
372 return apm_->num_output_channels() * | 374 return apm_->num_output_channels() * |
373 apm_->num_reverse_channels(); | 375 apm_->num_reverse_channels(); |
374 } | 376 } |
375 | 377 |
376 int EchoCancellationImpl::GetHandleError(void* handle) const { | 378 int EchoCancellationImpl::GetHandleError(void* handle) const { |
377 assert(handle != NULL); | 379 assert(handle != NULL); |
378 return MapError(WebRtcAec_get_error_code(static_cast<Handle*>(handle))); | 380 return MapError(WebRtcAec_get_error_code(static_cast<Handle*>(handle))); |
379 } | 381 } |
380 } // namespace webrtc | 382 } // namespace webrtc |
OLD | NEW |