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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 const size_t EchoCancellationImpl::kAllowedValuesOfSamplesPerFrame1; | 58 const size_t EchoCancellationImpl::kAllowedValuesOfSamplesPerFrame1; |
59 const size_t EchoCancellationImpl::kAllowedValuesOfSamplesPerFrame2; | 59 const size_t EchoCancellationImpl::kAllowedValuesOfSamplesPerFrame2; |
60 | 60 |
61 EchoCancellationImpl::EchoCancellationImpl(const AudioProcessing* apm, | 61 EchoCancellationImpl::EchoCancellationImpl( |
62 CriticalSectionWrapper* crit) | 62 const AudioProcessing* apm, |
63 CriticalSectionWrapper* crit, | |
64 rtc::ThreadChecker* render_thread_checker) | |
63 : ProcessingComponent(), | 65 : ProcessingComponent(), |
64 apm_(apm), | 66 apm_(apm), |
65 crit_(crit), | 67 crit_(crit), |
68 render_thread_checker_(render_thread_checker), | |
66 drift_compensation_enabled_(false), | 69 drift_compensation_enabled_(false), |
67 metrics_enabled_(false), | 70 metrics_enabled_(false), |
68 suppression_level_(kModerateSuppression), | 71 suppression_level_(kModerateSuppression), |
69 stream_drift_samples_(0), | 72 stream_drift_samples_(0), |
70 was_stream_drift_set_(false), | 73 was_stream_drift_set_(false), |
71 stream_has_echo_(false), | 74 stream_has_echo_(false), |
72 delay_logging_enabled_(false), | 75 delay_logging_enabled_(false), |
73 extended_filter_enabled_(false), | 76 extended_filter_enabled_(false), |
74 delay_agnostic_enabled_(false), | 77 delay_agnostic_enabled_(false), |
75 render_queue_element_max_size_(0) { | 78 render_queue_element_max_size_(0) { |
76 AllocateRenderQueue(); | 79 AllocateRenderQueue(); |
77 } | 80 } |
78 | 81 |
79 EchoCancellationImpl::~EchoCancellationImpl() {} | 82 EchoCancellationImpl::~EchoCancellationImpl() {} |
80 | 83 |
81 int EchoCancellationImpl::ProcessRenderAudio(const AudioBuffer* audio) { | 84 int EchoCancellationImpl::ProcessRenderAudio(const AudioBuffer* audio) { |
85 RTC_DCHECK(render_thread_checker_->CalledOnValidThread()); | |
82 if (!is_component_enabled()) { | 86 if (!is_component_enabled()) { |
83 return apm_->kNoError; | 87 return apm_->kNoError; |
84 } | 88 } |
85 | 89 |
86 assert(audio->num_frames_per_band() <= 160); | 90 assert(audio->num_frames_per_band() <= 160); |
87 assert(audio->num_channels() == apm_->num_reverse_channels()); | 91 assert(audio->num_channels() == apm_->num_reverse_channels()); |
88 | 92 |
89 int err = apm_->kNoError; | 93 int err = apm_->kNoError; |
90 | 94 |
91 // The ordering convention must be followed to pass to the correct AEC. | 95 // The ordering convention must be followed to pass to the correct AEC. |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
432 48000); | 436 48000); |
433 } | 437 } |
434 | 438 |
435 int EchoCancellationImpl::ConfigureHandle(void* handle) const { | 439 int EchoCancellationImpl::ConfigureHandle(void* handle) const { |
436 assert(handle != NULL); | 440 assert(handle != NULL); |
437 AecConfig config; | 441 AecConfig config; |
438 config.metricsMode = metrics_enabled_; | 442 config.metricsMode = metrics_enabled_; |
439 config.nlpMode = MapSetting(suppression_level_); | 443 config.nlpMode = MapSetting(suppression_level_); |
440 config.skewMode = drift_compensation_enabled_; | 444 config.skewMode = drift_compensation_enabled_; |
441 config.delay_logging = delay_logging_enabled_; | 445 config.delay_logging = delay_logging_enabled_; |
446 | |
hlundin-webrtc
2015/11/05 13:08:55
C-k
peah-webrtc
2015/11/06 07:31:14
Done.
| |
442 WebRtcAec_enable_extended_filter( | 447 WebRtcAec_enable_extended_filter( |
443 WebRtcAec_aec_core(static_cast<Handle*>(handle)), | 448 WebRtcAec_aec_core(static_cast<Handle*>(handle)), |
444 extended_filter_enabled_ ? 1 : 0); | 449 extended_filter_enabled_ ? 1 : 0); |
445 WebRtcAec_enable_delay_agnostic( | 450 WebRtcAec_enable_delay_agnostic( |
446 WebRtcAec_aec_core(static_cast<Handle*>(handle)), | 451 WebRtcAec_aec_core(static_cast<Handle*>(handle)), |
447 delay_agnostic_enabled_ ? 1 : 0); | 452 delay_agnostic_enabled_ ? 1 : 0); |
448 return WebRtcAec_set_config(static_cast<Handle*>(handle), config); | 453 return WebRtcAec_set_config(static_cast<Handle*>(handle), config); |
449 } | 454 } |
450 | 455 |
451 int EchoCancellationImpl::num_handles_required() const { | 456 int EchoCancellationImpl::num_handles_required() const { |
452 return apm_->num_output_channels() * | 457 return apm_->num_output_channels() * |
453 apm_->num_reverse_channels(); | 458 apm_->num_reverse_channels(); |
454 } | 459 } |
455 | 460 |
456 int EchoCancellationImpl::GetHandleError(void* handle) const { | 461 int EchoCancellationImpl::GetHandleError(void* handle) const { |
457 assert(handle != NULL); | 462 assert(handle != NULL); |
458 return AudioProcessing::kUnspecifiedError; | 463 return AudioProcessing::kUnspecifiedError; |
459 } | 464 } |
460 | 465 |
461 } // namespace webrtc | 466 } // namespace webrtc |
OLD | NEW |