| 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 |
| 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CANCELLATION_IMPL_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CANCELLATION_IMPL_H_ |
| 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CANCELLATION_IMPL_H_ | 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CANCELLATION_IMPL_H_ |
| 13 | 13 |
| 14 #include "webrtc/base/scoped_ptr.h" | 14 #include "webrtc/base/scoped_ptr.h" |
| 15 #include "webrtc/base/thread_checker.h" |
| 15 #include "webrtc/common_audio/swap_queue.h" | 16 #include "webrtc/common_audio/swap_queue.h" |
| 16 #include "webrtc/modules/audio_processing/include/audio_processing.h" | 17 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
| 17 #include "webrtc/modules/audio_processing/processing_component.h" | 18 #include "webrtc/modules/audio_processing/processing_component.h" |
| 18 | 19 |
| 19 namespace webrtc { | 20 namespace webrtc { |
| 20 | 21 |
| 21 namespace { | 22 namespace { |
| 22 // Functor to use when supplying a verifier function for the queue item | 23 // Functor to use when supplying a verifier function for the queue item |
| 23 // verifcation. | 24 // verifcation. |
| 24 class AecRenderQueueItemVerifier { | 25 class AecRenderQueueItemVerifier { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 39 | 40 |
| 40 } // namespace anonymous | 41 } // namespace anonymous |
| 41 | 42 |
| 42 class AudioBuffer; | 43 class AudioBuffer; |
| 43 class CriticalSectionWrapper; | 44 class CriticalSectionWrapper; |
| 44 | 45 |
| 45 class EchoCancellationImpl : public EchoCancellation, | 46 class EchoCancellationImpl : public EchoCancellation, |
| 46 public ProcessingComponent { | 47 public ProcessingComponent { |
| 47 public: | 48 public: |
| 48 EchoCancellationImpl(const AudioProcessing* apm, | 49 EchoCancellationImpl(const AudioProcessing* apm, |
| 49 CriticalSectionWrapper* crit); | 50 CriticalSectionWrapper* crit, |
| 51 rtc::ThreadChecker* render_thread, |
| 52 rtc::ThreadChecker* capture_thread); |
| 50 virtual ~EchoCancellationImpl(); | 53 virtual ~EchoCancellationImpl(); |
| 51 | 54 |
| 52 int ProcessRenderAudio(const AudioBuffer* audio); | 55 int ProcessRenderAudio(const AudioBuffer* audio); |
| 53 int ProcessCaptureAudio(AudioBuffer* audio); | 56 int ProcessCaptureAudio(AudioBuffer* audio); |
| 54 | 57 |
| 55 // EchoCancellation implementation. | 58 // EchoCancellation implementation. |
| 56 bool is_enabled() const override; | 59 bool is_enabled() const override; |
| 57 int stream_drift_samples() const override; | 60 int stream_drift_samples() const override; |
| 58 SuppressionLevel suppression_level() const override; | 61 SuppressionLevel suppression_level() const override; |
| 59 bool is_drift_compensation_enabled() const override; | 62 bool is_drift_compensation_enabled() const override; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 int InitializeHandle(void* handle) const override; | 100 int InitializeHandle(void* handle) const override; |
| 98 int ConfigureHandle(void* handle) const override; | 101 int ConfigureHandle(void* handle) const override; |
| 99 void DestroyHandle(void* handle) const override; | 102 void DestroyHandle(void* handle) const override; |
| 100 int num_handles_required() const override; | 103 int num_handles_required() const override; |
| 101 int GetHandleError(void* handle) const override; | 104 int GetHandleError(void* handle) const override; |
| 102 | 105 |
| 103 void AllocateRenderQueue(); | 106 void AllocateRenderQueue(); |
| 104 | 107 |
| 105 const AudioProcessing* apm_; | 108 const AudioProcessing* apm_; |
| 106 CriticalSectionWrapper* crit_; | 109 CriticalSectionWrapper* crit_; |
| 110 const rtc::ThreadChecker* const render_thread_; |
| 111 const rtc::ThreadChecker* const capture_thread_; |
| 112 |
| 107 bool drift_compensation_enabled_; | 113 bool drift_compensation_enabled_; |
| 108 bool metrics_enabled_; | 114 bool metrics_enabled_; |
| 109 SuppressionLevel suppression_level_; | 115 SuppressionLevel suppression_level_; |
| 110 int stream_drift_samples_; | 116 int stream_drift_samples_; |
| 111 bool was_stream_drift_set_; | 117 bool was_stream_drift_set_; |
| 112 bool stream_has_echo_; | 118 bool stream_has_echo_; |
| 113 bool delay_logging_enabled_; | 119 bool delay_logging_enabled_; |
| 114 bool extended_filter_enabled_; | 120 bool extended_filter_enabled_; |
| 115 bool delay_agnostic_enabled_; | 121 bool delay_agnostic_enabled_; |
| 116 | 122 |
| 117 size_t render_queue_element_max_size_; | 123 size_t render_queue_element_max_size_; |
| 118 std::vector<float> render_queue_buffer_; | 124 std::vector<float> render_queue_buffer_; |
| 119 std::vector<float> capture_queue_buffer_; | 125 std::vector<float> capture_queue_buffer_; |
| 120 rtc::scoped_ptr<SwapQueue<std::vector<float>, AecRenderQueueItemVerifier> > | 126 rtc::scoped_ptr<SwapQueue<std::vector<float>, AecRenderQueueItemVerifier> > |
| 121 render_signal_queue_; | 127 render_signal_queue_; |
| 122 }; | 128 }; |
| 123 | 129 |
| 124 } // namespace webrtc | 130 } // namespace webrtc |
| 125 | 131 |
| 126 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CANCELLATION_IMPL_H_ | 132 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CANCELLATION_IMPL_H_ |
| OLD | NEW |