| 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" |
| 15 #include "webrtc/common_audio/swap_queue.h" |
| 14 #include "webrtc/modules/audio_processing/include/audio_processing.h" | 16 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
| 15 #include "webrtc/modules/audio_processing/processing_component.h" | 17 #include "webrtc/modules/audio_processing/processing_component.h" |
| 16 | 18 |
| 17 namespace webrtc { | 19 namespace webrtc { |
| 18 | 20 |
| 19 class AudioBuffer; | 21 class AudioBuffer; |
| 20 class CriticalSectionWrapper; | 22 class CriticalSectionWrapper; |
| 21 | 23 |
| 22 class EchoControlMobileImpl : public EchoControlMobile, | 24 class EchoControlMobileImpl : public EchoControlMobile, |
| 23 public ProcessingComponent { | 25 public ProcessingComponent { |
| 24 public: | 26 public: |
| 25 EchoControlMobileImpl(const AudioProcessing* apm, | 27 EchoControlMobileImpl(const AudioProcessing* apm, |
| 26 CriticalSectionWrapper* crit); | 28 CriticalSectionWrapper* crit); |
| 27 virtual ~EchoControlMobileImpl(); | 29 virtual ~EchoControlMobileImpl(); |
| 28 | 30 |
| 29 int ProcessRenderAudio(const AudioBuffer* audio); | 31 int ProcessRenderAudio(const AudioBuffer* audio); |
| 30 int ProcessCaptureAudio(AudioBuffer* audio); | 32 int ProcessCaptureAudio(AudioBuffer* audio); |
| 31 | 33 |
| 32 // EchoControlMobile implementation. | 34 // EchoControlMobile implementation. |
| 33 bool is_enabled() const override; | 35 bool is_enabled() const override; |
| 34 RoutingMode routing_mode() const override; | 36 RoutingMode routing_mode() const override; |
| 35 bool is_comfort_noise_enabled() const override; | 37 bool is_comfort_noise_enabled() const override; |
| 36 | 38 |
| 37 // ProcessingComponent implementation. | 39 // ProcessingComponent implementation. |
| 38 int Initialize() override; | 40 int Initialize() override; |
| 39 | 41 |
| 42 // Reads render side data that has been queued on the render call. |
| 43 void ReadQueuedRenderData(); |
| 44 |
| 40 private: | 45 private: |
| 46 static const size_t kMaxNumChannelsPerFrameToBuffer = 2; |
| 47 static const size_t kMinNumSamplesPerFrameToBuffer = 80; |
| 48 static const size_t kMaxNumSamplesPerFrameToBuffer = 160; |
| 49 // TODO(peah): Decrease this once we properly handle hugely unbalanced |
| 50 // reverse and forward call numbers. |
| 51 static const size_t kMaxNumFramesToBuffer = 100; |
| 52 |
| 41 // EchoControlMobile implementation. | 53 // EchoControlMobile implementation. |
| 42 int Enable(bool enable) override; | 54 int Enable(bool enable) override; |
| 43 int set_routing_mode(RoutingMode mode) override; | 55 int set_routing_mode(RoutingMode mode) override; |
| 44 int enable_comfort_noise(bool enable) override; | 56 int enable_comfort_noise(bool enable) override; |
| 45 int SetEchoPath(const void* echo_path, size_t size_bytes) override; | 57 int SetEchoPath(const void* echo_path, size_t size_bytes) override; |
| 46 int GetEchoPath(void* echo_path, size_t size_bytes) const override; | 58 int GetEchoPath(void* echo_path, size_t size_bytes) const override; |
| 47 | 59 |
| 48 // ProcessingComponent implementation. | 60 // ProcessingComponent implementation. |
| 49 void* CreateHandle() const override; | 61 void* CreateHandle() const override; |
| 50 int InitializeHandle(void* handle) const override; | 62 int InitializeHandle(void* handle) const override; |
| 51 int ConfigureHandle(void* handle) const override; | 63 int ConfigureHandle(void* handle) const override; |
| 52 void DestroyHandle(void* handle) const override; | 64 void DestroyHandle(void* handle) const override; |
| 53 int num_handles_required() const override; | 65 int num_handles_required() const override; |
| 54 int GetHandleError(void* handle) const override; | 66 int GetHandleError(void* handle) const override; |
| 55 | 67 |
| 68 // SwapQueue element verifier |
| 69 static bool RenderQueueItemVerifier(const std::vector<int16_t>& v); |
| 70 |
| 56 const AudioProcessing* apm_; | 71 const AudioProcessing* apm_; |
| 57 CriticalSectionWrapper* crit_; | 72 CriticalSectionWrapper* crit_; |
| 58 RoutingMode routing_mode_; | 73 RoutingMode routing_mode_; |
| 59 bool comfort_noise_enabled_; | 74 bool comfort_noise_enabled_; |
| 60 unsigned char* external_echo_path_; | 75 unsigned char* external_echo_path_; |
| 76 |
| 77 std::vector<int16_t> render_queue_buffer_; |
| 78 std::vector<int16_t> capture_queue_buffer_; |
| 79 rtc::scoped_ptr<SwapQueue<std::vector<int16_t>, &RenderQueueItemVerifier>> |
| 80 render_signal_queue_; |
| 61 }; | 81 }; |
| 62 } // namespace webrtc | 82 } // namespace webrtc |
| 63 | 83 |
| 64 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CONTROL_MOBILE_IMPL_H_ | 84 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CONTROL_MOBILE_IMPL_H_ |
| OLD | NEW |