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

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

Issue 1803433003: Removed the dependency on AudioProcessingImpl in EchoControlMobileImpl (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Added missing DCHECKS for the stream_properties_ 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/constructormagic.h"
17 #include "webrtc/base/criticalsection.h" 17 #include "webrtc/base/criticalsection.h"
18 #include "webrtc/common_audio/swap_queue.h" 18 #include "webrtc/common_audio/swap_queue.h"
19 #include "webrtc/modules/audio_processing/include/audio_processing.h" 19 #include "webrtc/modules/audio_processing/include/audio_processing.h"
20 #include "webrtc/modules/audio_processing/render_queue_item_verifier.h" 20 #include "webrtc/modules/audio_processing/render_queue_item_verifier.h"
21 21
22 namespace webrtc { 22 namespace webrtc {
23 23
24 class AudioBuffer; 24 class AudioBuffer;
25 25
26 class EchoControlMobileImpl : public EchoControlMobile { 26 class EchoControlMobileImpl : public EchoControlMobile {
27 public: 27 public:
28 EchoControlMobileImpl(const AudioProcessing* apm, 28 EchoControlMobileImpl(rtc::CriticalSection* crit_render,
29 rtc::CriticalSection* crit_render,
30 rtc::CriticalSection* crit_capture); 29 rtc::CriticalSection* crit_capture);
31 30
32 virtual ~EchoControlMobileImpl(); 31 virtual ~EchoControlMobileImpl();
33 32
34 int ProcessRenderAudio(const AudioBuffer* audio); 33 int ProcessRenderAudio(const AudioBuffer* audio);
35 int ProcessCaptureAudio(AudioBuffer* audio); 34 int ProcessCaptureAudio(AudioBuffer* audio, int stream_delay_ms);
36 35
37 // EchoControlMobile implementation. 36 // EchoControlMobile implementation.
38 bool is_enabled() const override; 37 bool is_enabled() const override;
39 RoutingMode routing_mode() const override; 38 RoutingMode routing_mode() const override;
40 bool is_comfort_noise_enabled() const override; 39 bool is_comfort_noise_enabled() const override;
41 40
42 void Initialize(); 41 void Initialize(int sample_rate_hz,
42 size_t num_reverse_channels,
43 size_t num_output_channels);
43 44
44 // Reads render side data that has been queued on the render call. 45 // Reads render side data that has been queued on the render call.
45 void ReadQueuedRenderData(); 46 void ReadQueuedRenderData();
46 47
47 private: 48 private:
48 class Canceller; 49 class Canceller;
50 struct StreamProperties;
49 51
50 // EchoControlMobile implementation. 52 // EchoControlMobile implementation.
51 int Enable(bool enable) override; 53 int Enable(bool enable) override;
52 int set_routing_mode(RoutingMode mode) override; 54 int set_routing_mode(RoutingMode mode) override;
53 int enable_comfort_noise(bool enable) override; 55 int enable_comfort_noise(bool enable) override;
54 int SetEchoPath(const void* echo_path, size_t size_bytes) override; 56 int SetEchoPath(const void* echo_path, size_t size_bytes) override;
55 int GetEchoPath(void* echo_path, size_t size_bytes) const override; 57 int GetEchoPath(void* echo_path, size_t size_bytes) const override;
56 58
57 size_t num_handles_required() const; 59 size_t num_handles_required() const;
58 60
59 void AllocateRenderQueue(); 61 void AllocateRenderQueue();
60 int Configure(); 62 int Configure();
61 63
62 // Not guarded as its public API is thread safe.
63 const AudioProcessing* apm_;
64
65 rtc::CriticalSection* const crit_render_ ACQUIRED_BEFORE(crit_capture_); 64 rtc::CriticalSection* const crit_render_ ACQUIRED_BEFORE(crit_capture_);
66 rtc::CriticalSection* const crit_capture_; 65 rtc::CriticalSection* const crit_capture_;
67 66
68 bool enabled_ = false; 67 bool enabled_ = false;
69 68
70 RoutingMode routing_mode_ GUARDED_BY(crit_capture_); 69 RoutingMode routing_mode_ GUARDED_BY(crit_capture_);
71 bool comfort_noise_enabled_ GUARDED_BY(crit_capture_); 70 bool comfort_noise_enabled_ GUARDED_BY(crit_capture_);
72 unsigned char* external_echo_path_ GUARDED_BY(crit_render_) 71 unsigned char* external_echo_path_ GUARDED_BY(crit_render_)
73 GUARDED_BY(crit_capture_); 72 GUARDED_BY(crit_capture_);
74 73
75 size_t render_queue_element_max_size_ GUARDED_BY(crit_render_) 74 size_t render_queue_element_max_size_ GUARDED_BY(crit_render_)
76 GUARDED_BY(crit_capture_); 75 GUARDED_BY(crit_capture_);
77 76
78 std::vector<int16_t> render_queue_buffer_ GUARDED_BY(crit_render_); 77 std::vector<int16_t> render_queue_buffer_ GUARDED_BY(crit_render_);
79 std::vector<int16_t> capture_queue_buffer_ GUARDED_BY(crit_capture_); 78 std::vector<int16_t> capture_queue_buffer_ GUARDED_BY(crit_capture_);
80 79
81 // Lock protection not needed. 80 // Lock protection not needed.
82 std::unique_ptr< 81 std::unique_ptr<
83 SwapQueue<std::vector<int16_t>, RenderQueueItemVerifier<int16_t>>> 82 SwapQueue<std::vector<int16_t>, RenderQueueItemVerifier<int16_t>>>
84 render_signal_queue_; 83 render_signal_queue_;
85 84
86 std::vector<std::unique_ptr<Canceller>> cancellers_; 85 std::vector<std::unique_ptr<Canceller>> cancellers_;
86 std::unique_ptr<StreamProperties> stream_properties_;
87
87 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(EchoControlMobileImpl); 88 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(EchoControlMobileImpl);
88 }; 89 };
89 } // namespace webrtc 90 } // namespace webrtc
90 91
91 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CONTROL_MOBILE_IMPL_H_ 92 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CONTROL_MOBILE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698