Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 | |
|
hlundin-webrtc
2015/11/05 16:11:22
No
peah-webrtc
2015/11/06 09:54:32
Done.
| |
| 1 /* | 2 /* |
| 2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 3 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. |
| 3 * | 4 * |
| 4 * Use of this source code is governed by a BSD-style license | 5 * 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 | 6 * 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 | 7 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 8 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 9 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 10 */ |
| 10 | 11 |
| 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CONTROL_MOBILE_IMPL_H_ | 12 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CONTROL_MOBILE_IMPL_H_ |
| 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CONTROL_MOBILE_IMPL_H_ | 13 #define WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CONTROL_MOBILE_IMPL_H_ |
| 13 | 14 |
| 14 #include "webrtc/base/scoped_ptr.h" | 15 #include "webrtc/base/scoped_ptr.h" |
| 16 #include "webrtc/base/thread_annotations.h" | |
|
hlundin-webrtc
2015/11/05 16:11:22
Not used.
peah-webrtc
2015/11/06 09:54:32
Done.
| |
| 15 #include "webrtc/base/thread_checker.h" | 17 #include "webrtc/base/thread_checker.h" |
| 16 #include "webrtc/common_audio/swap_queue.h" | 18 #include "webrtc/common_audio/swap_queue.h" |
| 17 #include "webrtc/modules/audio_processing/include/audio_processing.h" | 19 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
| 18 #include "webrtc/modules/audio_processing/processing_component.h" | 20 #include "webrtc/modules/audio_processing/processing_component.h" |
| 19 | 21 |
| 20 namespace webrtc { | 22 namespace webrtc { |
| 21 | 23 |
| 22 namespace { | 24 namespace { |
| 23 // 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 |
| 24 // verifcation. | 26 // verifcation. |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 36 }; | 38 }; |
| 37 | 39 |
| 38 } // namespace anonymous | 40 } // namespace anonymous |
| 39 | 41 |
| 40 class AudioBuffer; | 42 class AudioBuffer; |
| 41 class CriticalSectionWrapper; | 43 class CriticalSectionWrapper; |
| 42 | 44 |
| 43 class EchoControlMobileImpl : public EchoControlMobile, | 45 class EchoControlMobileImpl : public EchoControlMobile, |
| 44 public ProcessingComponent { | 46 public ProcessingComponent { |
| 45 public: | 47 public: |
| 48 // Called holding both the render and capture locks. | |
| 46 EchoControlMobileImpl(const AudioProcessing* apm, | 49 EchoControlMobileImpl(const AudioProcessing* apm, |
| 47 CriticalSectionWrapper* crit, | 50 rtc::CriticalSection* crit_render, |
| 51 rtc::CriticalSection* crit_capture, | |
| 48 rtc::ThreadChecker* render_thread_checker); | 52 rtc::ThreadChecker* render_thread_checker); |
| 49 virtual ~EchoControlMobileImpl(); | |
| 50 | 53 |
| 51 int ProcessRenderAudio(const AudioBuffer* audio); | 54 virtual ~EchoControlMobileImpl(); // Called holding both the render and |
| 52 int ProcessCaptureAudio(AudioBuffer* audio); | 55 // capture locks. |
| 56 | |
| 57 int ProcessRenderAudio( | |
|
hlundin-webrtc
2015/11/05 16:11:22
Again, please restore the one-line definitions whe
peah-webrtc
2015/11/06 09:54:32
Done.
| |
| 58 const AudioBuffer* audio); // Called holding the render lock. | |
| 59 int ProcessCaptureAudio( | |
| 60 AudioBuffer* audio); // Called holding the capture lock. | |
| 53 | 61 |
| 54 // EchoControlMobile implementation. | 62 // EchoControlMobile implementation. |
| 55 bool is_enabled() const override; | 63 bool is_enabled() const override; // Aquires the capture lock. |
| 56 RoutingMode routing_mode() const override; | 64 RoutingMode routing_mode() const override; // Aquires the capture lock. |
| 57 bool is_comfort_noise_enabled() const override; | 65 bool is_comfort_noise_enabled() const override; // Aquires the capture lock. |
| 58 | 66 |
| 59 // ProcessingComponent implementation. | 67 // ProcessingComponent implementation. |
| 60 int Initialize() override; | 68 int Initialize() |
| 69 override; // Called holding both the render and capture locks. | |
| 61 | 70 |
| 62 // Reads render side data that has been queued on the render call. | 71 // Reads render side data that has been queued on the render call. |
| 63 void ReadQueuedRenderData(); | 72 void ReadQueuedRenderData(); // Called holding the capture lock. |
| 64 | 73 |
| 65 private: | 74 private: |
| 66 static const size_t kAllowedValuesOfSamplesPerFrame1 = 80; | 75 static const size_t kAllowedValuesOfSamplesPerFrame1 = 80; |
| 67 static const size_t kAllowedValuesOfSamplesPerFrame2 = 160; | 76 static const size_t kAllowedValuesOfSamplesPerFrame2 = 160; |
| 68 // TODO(peah): Decrease this once we properly handle hugely unbalanced | 77 // TODO(peah): Decrease this once we properly handle hugely unbalanced |
| 69 // reverse and forward call numbers. | 78 // reverse and forward call numbers. |
| 70 static const size_t kMaxNumFramesToBuffer = 100; | 79 static const size_t kMaxNumFramesToBuffer = 100; |
| 71 | 80 |
| 72 // EchoControlMobile implementation. | 81 // EchoControlMobile implementation. |
| 73 int Enable(bool enable) override; | 82 int Enable( |
| 74 int set_routing_mode(RoutingMode mode) override; | 83 bool enable) override; // Aquires both the render and capture locks. |
| 75 int enable_comfort_noise(bool enable) override; | 84 int set_routing_mode(RoutingMode mode) override; // Aquires the capture lock. |
| 76 int SetEchoPath(const void* echo_path, size_t size_bytes) override; | 85 int enable_comfort_noise(bool enable) override; // Aquires the capture lock. |
| 77 int GetEchoPath(void* echo_path, size_t size_bytes) const override; | 86 int SetEchoPath(const void* echo_path, size_t size_bytes) |
| 87 override; // Aquires both the capture and render locks. | |
| 88 int GetEchoPath(void* echo_path, size_t size_bytes) | |
| 89 const override; // Aquires the capture lock. | |
| 78 | 90 |
| 79 // ProcessingComponent implementation. | 91 // ProcessingComponent implementation. |
| 80 void* CreateHandle() const override; | 92 void* CreateHandle() |
| 81 int InitializeHandle(void* handle) const override; | 93 const override; // Called holding both the render and capture locks. |
| 82 int ConfigureHandle(void* handle) const override; | 94 int InitializeHandle(void* handle) |
| 83 void DestroyHandle(void* handle) const override; | 95 const override; // Called holding both the render and capture locks. |
| 84 int num_handles_required() const override; | 96 int ConfigureHandle(void* handle) |
| 85 int GetHandleError(void* handle) const override; | 97 const override; // Called holding both the render and capture locks. |
| 98 void DestroyHandle(void* handle) | |
| 99 const override; // Called holding both the render and capture locks. | |
| 100 int num_handles_required() | |
| 101 const override; // Called holding both the render and capture locks. | |
| 102 int GetHandleError(void* handle) | |
| 103 const override; // Called holding both the render and capture locks. | |
| 86 | 104 |
| 87 void AllocateRenderQueue(); | 105 void |
| 106 AllocateRenderQueue(); // Called holding both the render and capture locks. | |
| 88 | 107 |
| 89 const AudioProcessing* apm_; | 108 const AudioProcessing* apm_; |
| 90 CriticalSectionWrapper* crit_; | 109 rtc::CriticalSection* const crit_render_; |
| 110 rtc::CriticalSection* const crit_capture_; | |
| 91 const rtc::ThreadChecker* const render_thread_checker_; | 111 const rtc::ThreadChecker* const render_thread_checker_; |
| 92 RoutingMode routing_mode_; | 112 RoutingMode routing_mode_; |
| 93 bool comfort_noise_enabled_; | 113 bool comfort_noise_enabled_; |
| 94 unsigned char* external_echo_path_; | 114 unsigned char* external_echo_path_; |
| 95 | 115 |
| 96 size_t render_queue_element_max_size_; | 116 size_t render_queue_element_max_size_; |
| 97 std::vector<int16_t> render_queue_buffer_; | 117 std::vector<int16_t> render_queue_buffer_; |
| 98 std::vector<int16_t> capture_queue_buffer_; | 118 std::vector<int16_t> capture_queue_buffer_; |
| 99 rtc::scoped_ptr<SwapQueue<std::vector<int16_t>, AecmRenderQueueItemVerifier>> | 119 rtc::scoped_ptr<SwapQueue<std::vector<int16_t>, AecmRenderQueueItemVerifier> > |
| 100 render_signal_queue_; | 120 render_signal_queue_; // Lock protection not needed. |
| 101 }; | 121 }; |
| 102 } // namespace webrtc | 122 } // namespace webrtc |
| 103 | 123 |
| 104 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CONTROL_MOBILE_IMPL_H_ | 124 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CONTROL_MOBILE_IMPL_H_ |
| OLD | NEW |