Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(482)

Side by Side Diff: webrtc/modules/audio_processing/echo_control_mobile_impl.h

Issue 1772453002: Removing dependency of the EchoControlMobileImpl class on ProcessingComponent. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Changes in response to reviewer comments Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <memory> 14 #include <memory>
15 15
16 #include "webrtc/base/constructormagic.h"
16 #include "webrtc/base/criticalsection.h" 17 #include "webrtc/base/criticalsection.h"
17 #include "webrtc/common_audio/swap_queue.h" 18 #include "webrtc/common_audio/swap_queue.h"
18 #include "webrtc/modules/audio_processing/include/audio_processing.h" 19 #include "webrtc/modules/audio_processing/include/audio_processing.h"
19 #include "webrtc/modules/audio_processing/processing_component.h" 20 #include "webrtc/modules/audio_processing/processing_component.h"
20 21
21 namespace webrtc { 22 namespace webrtc {
22 23
23 class AudioBuffer; 24 class AudioBuffer;
24 25
25 class EchoControlMobileImpl : public EchoControlMobile, 26 class EchoControlMobileImpl : public EchoControlMobile {
26 public ProcessingComponent {
27 public: 27 public:
28 EchoControlMobileImpl(const AudioProcessing* apm, 28 EchoControlMobileImpl(const AudioProcessing* apm,
29 rtc::CriticalSection* crit_render, 29 rtc::CriticalSection* crit_render,
30 rtc::CriticalSection* crit_capture); 30 rtc::CriticalSection* crit_capture);
31 31
32 virtual ~EchoControlMobileImpl(); 32 virtual ~EchoControlMobileImpl();
33 33
34 int ProcessRenderAudio(const AudioBuffer* audio); 34 int ProcessRenderAudio(const AudioBuffer* audio);
35 int ProcessCaptureAudio(AudioBuffer* audio); 35 int ProcessCaptureAudio(AudioBuffer* audio);
36 36
37 // EchoControlMobile implementation. 37 // EchoControlMobile implementation.
38 bool is_enabled() const override; 38 bool is_enabled() const override;
39 RoutingMode routing_mode() const override; 39 RoutingMode routing_mode() const override;
40 bool is_comfort_noise_enabled() const override; 40 bool is_comfort_noise_enabled() const override;
41 41
42 // ProcessingComponent implementation. 42 void Initialize();
43 int Initialize() override;
44 43
45 // Reads render side data that has been queued on the render call. 44 // Reads render side data that has been queued on the render call.
46 void ReadQueuedRenderData(); 45 void ReadQueuedRenderData();
47 46
48 private: 47 private:
48 class Canceller;
49
49 // EchoControlMobile implementation. 50 // EchoControlMobile implementation.
50 int Enable(bool enable) override; 51 int Enable(bool enable) override;
51 int set_routing_mode(RoutingMode mode) override; 52 int set_routing_mode(RoutingMode mode) override;
52 int enable_comfort_noise(bool enable) override; 53 int enable_comfort_noise(bool enable) override;
53 int SetEchoPath(const void* echo_path, size_t size_bytes) override; 54 int SetEchoPath(const void* echo_path, size_t size_bytes) override;
54 int GetEchoPath(void* echo_path, size_t size_bytes) const override; 55 int GetEchoPath(void* echo_path, size_t size_bytes) const override;
55 56
56 // ProcessingComponent implementation. 57 size_t num_handles_required() const;
57 // Called holding both the render and capture locks.
58 void* CreateHandle() const override;
59 int InitializeHandle(void* handle) const override;
60 int ConfigureHandle(void* handle) const override;
61 void DestroyHandle(void* handle) const override;
62 size_t num_handles_required() const override;
63 int GetHandleError(void* handle) const override;
64 58
65 void AllocateRenderQueue(); 59 void AllocateRenderQueue();
60 int Configure();
66 61
67 // Not guarded as its public API is thread safe. 62 // Not guarded as its public API is thread safe.
68 const AudioProcessing* apm_; 63 const AudioProcessing* apm_;
69 64
70 rtc::CriticalSection* const crit_render_ ACQUIRED_BEFORE(crit_capture_); 65 rtc::CriticalSection* const crit_render_ ACQUIRED_BEFORE(crit_capture_);
71 rtc::CriticalSection* const crit_capture_; 66 rtc::CriticalSection* const crit_capture_;
72 67
68 bool enabled_ = false;
69
73 RoutingMode routing_mode_ GUARDED_BY(crit_capture_); 70 RoutingMode routing_mode_ GUARDED_BY(crit_capture_);
74 bool comfort_noise_enabled_ GUARDED_BY(crit_capture_); 71 bool comfort_noise_enabled_ GUARDED_BY(crit_capture_);
75 unsigned char* external_echo_path_ GUARDED_BY(crit_render_) 72 unsigned char* external_echo_path_ GUARDED_BY(crit_render_)
76 GUARDED_BY(crit_capture_); 73 GUARDED_BY(crit_capture_);
77 74
78 size_t render_queue_element_max_size_ GUARDED_BY(crit_render_) 75 size_t render_queue_element_max_size_ GUARDED_BY(crit_render_)
79 GUARDED_BY(crit_capture_); 76 GUARDED_BY(crit_capture_);
80 77
81 std::vector<int16_t> render_queue_buffer_ GUARDED_BY(crit_render_); 78 std::vector<int16_t> render_queue_buffer_ GUARDED_BY(crit_render_);
82 std::vector<int16_t> capture_queue_buffer_ GUARDED_BY(crit_capture_); 79 std::vector<int16_t> capture_queue_buffer_ GUARDED_BY(crit_capture_);
83 80
84 // Lock protection not needed. 81 // Lock protection not needed.
85 std::unique_ptr< 82 std::unique_ptr<
86 SwapQueue<std::vector<int16_t>, RenderQueueItemVerifier<int16_t>>> 83 SwapQueue<std::vector<int16_t>, RenderQueueItemVerifier<int16_t>>>
87 render_signal_queue_; 84 render_signal_queue_;
85
86 std::vector<std::unique_ptr<Canceller>> cancellers_;
87 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(EchoControlMobileImpl);
88 }; 88 };
89 } // namespace webrtc 89 } // namespace webrtc
90 90
91 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CONTROL_MOBILE_IMPL_H_ 91 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CONTROL_MOBILE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698