| 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_CONTROL_MOBILE_IMPL_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CONTROL_MOBILE_IMPL_H_ |
| 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CONTROL_MOBILE_IMPL_H_ | 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CONTROL_MOBILE_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 class AudioBuffer; | 22 class AudioBuffer; |
| 22 class CriticalSectionWrapper; | 23 class CriticalSectionWrapper; |
| 23 | 24 |
| 24 // Functor to use when supplying a verifier function for the queue item | 25 // Functor to use when supplying a verifier function for the queue item |
| 25 // verifcation. | 26 // verifcation. |
| 26 class AecmRenderQueueItemVerifier { | 27 class AecmRenderQueueItemVerifier { |
| 27 public: | 28 public: |
| 28 explicit AecmRenderQueueItemVerifier(size_t minimum_capacity) | 29 explicit AecmRenderQueueItemVerifier(size_t minimum_capacity) |
| 29 : minimum_capacity_(minimum_capacity) {} | 30 : minimum_capacity_(minimum_capacity) {} |
| 30 | 31 |
| 31 bool operator()(const std::vector<int16_t>& v) const { | 32 bool operator()(const std::vector<int16_t>& v) const { |
| 32 return v.capacity() >= minimum_capacity_; | 33 return v.capacity() >= minimum_capacity_; |
| 33 } | 34 } |
| 34 | 35 |
| 35 private: | 36 private: |
| 36 size_t minimum_capacity_; | 37 size_t minimum_capacity_; |
| 37 }; | 38 }; |
| 38 | 39 |
| 39 class EchoControlMobileImpl : public EchoControlMobile, | 40 class EchoControlMobileImpl : public EchoControlMobile, |
| 40 public ProcessingComponent { | 41 public ProcessingComponent { |
| 41 public: | 42 public: |
| 42 EchoControlMobileImpl(const AudioProcessing* apm, | 43 EchoControlMobileImpl(const AudioProcessing* apm, |
| 43 CriticalSectionWrapper* crit); | 44 CriticalSectionWrapper* crit, |
| 45 const rtc::ThreadChecker* render_thread_checker); |
| 44 virtual ~EchoControlMobileImpl(); | 46 virtual ~EchoControlMobileImpl(); |
| 45 | 47 |
| 46 int ProcessRenderAudio(const AudioBuffer* audio); | 48 int ProcessRenderAudio(const AudioBuffer* audio); |
| 47 int ProcessCaptureAudio(AudioBuffer* audio); | 49 int ProcessCaptureAudio(AudioBuffer* audio); |
| 48 | 50 |
| 49 // EchoControlMobile implementation. | 51 // EchoControlMobile implementation. |
| 50 bool is_enabled() const override; | 52 bool is_enabled() const override; |
| 51 RoutingMode routing_mode() const override; | 53 RoutingMode routing_mode() const override; |
| 52 bool is_comfort_noise_enabled() const override; | 54 bool is_comfort_noise_enabled() const override; |
| 53 | 55 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 76 int InitializeHandle(void* handle) const override; | 78 int InitializeHandle(void* handle) const override; |
| 77 int ConfigureHandle(void* handle) const override; | 79 int ConfigureHandle(void* handle) const override; |
| 78 void DestroyHandle(void* handle) const override; | 80 void DestroyHandle(void* handle) const override; |
| 79 int num_handles_required() const override; | 81 int num_handles_required() const override; |
| 80 int GetHandleError(void* handle) const override; | 82 int GetHandleError(void* handle) const override; |
| 81 | 83 |
| 82 void AllocateRenderQueue(); | 84 void AllocateRenderQueue(); |
| 83 | 85 |
| 84 const AudioProcessing* apm_; | 86 const AudioProcessing* apm_; |
| 85 CriticalSectionWrapper* crit_; | 87 CriticalSectionWrapper* crit_; |
| 88 const rtc::ThreadChecker* const render_thread_checker_; |
| 86 RoutingMode routing_mode_; | 89 RoutingMode routing_mode_; |
| 87 bool comfort_noise_enabled_; | 90 bool comfort_noise_enabled_; |
| 88 unsigned char* external_echo_path_; | 91 unsigned char* external_echo_path_; |
| 89 | 92 |
| 90 size_t render_queue_element_max_size_; | 93 size_t render_queue_element_max_size_; |
| 91 std::vector<int16_t> render_queue_buffer_; | 94 std::vector<int16_t> render_queue_buffer_; |
| 92 std::vector<int16_t> capture_queue_buffer_; | 95 std::vector<int16_t> capture_queue_buffer_; |
| 93 rtc::scoped_ptr<SwapQueue<std::vector<int16_t>, AecmRenderQueueItemVerifier>> | 96 rtc::scoped_ptr<SwapQueue<std::vector<int16_t>, AecmRenderQueueItemVerifier>> |
| 94 render_signal_queue_; | 97 render_signal_queue_; |
| 95 }; | 98 }; |
| 96 } // namespace webrtc | 99 } // namespace webrtc |
| 97 | 100 |
| 98 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CONTROL_MOBILE_IMPL_H_ | 101 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CONTROL_MOBILE_IMPL_H_ |
| OLD | NEW |