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 |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 class AudioBuffer; | 25 class AudioBuffer; |
26 | 26 |
27 class EchoControlMobileImpl : public EchoControlMobile { | 27 class EchoControlMobileImpl : public EchoControlMobile { |
28 public: | 28 public: |
29 EchoControlMobileImpl(rtc::CriticalSection* crit_render, | 29 EchoControlMobileImpl(rtc::CriticalSection* crit_render, |
30 rtc::CriticalSection* crit_capture); | 30 rtc::CriticalSection* crit_capture); |
31 | 31 |
32 ~EchoControlMobileImpl() override; | 32 ~EchoControlMobileImpl() override; |
33 | 33 |
34 int ProcessRenderAudio(const AudioBuffer* audio); | 34 void ProcessRenderAudio(rtc::ArrayView<const int16_t> packed_render_audio); |
35 int ProcessCaptureAudio(AudioBuffer* audio, int stream_delay_ms); | 35 int ProcessCaptureAudio(AudioBuffer* audio, int stream_delay_ms); |
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 void Initialize(int sample_rate_hz, | 42 void Initialize(int sample_rate_hz, |
43 size_t num_reverse_channels, | 43 size_t num_reverse_channels, |
44 size_t num_output_channels); | 44 size_t num_output_channels); |
45 | 45 |
46 // Reads render side data that has been queued on the render call. | 46 static void PackRenderAudioBuffer(const AudioBuffer* audio, |
47 void ReadQueuedRenderData(); | 47 size_t num_output_channels, |
| 48 size_t num_channels, |
| 49 std::vector<int16_t>* packed_buffer); |
| 50 |
| 51 static size_t NumCancellersRequired(size_t num_output_channels, |
| 52 size_t num_reverse_channels); |
48 | 53 |
49 private: | 54 private: |
50 class Canceller; | 55 class Canceller; |
51 struct StreamProperties; | 56 struct StreamProperties; |
52 | 57 |
53 // EchoControlMobile implementation. | 58 // EchoControlMobile implementation. |
54 int Enable(bool enable) override; | 59 int Enable(bool enable) override; |
55 int set_routing_mode(RoutingMode mode) override; | 60 int set_routing_mode(RoutingMode mode) override; |
56 int enable_comfort_noise(bool enable) override; | 61 int enable_comfort_noise(bool enable) override; |
57 int SetEchoPath(const void* echo_path, size_t size_bytes) override; | 62 int SetEchoPath(const void* echo_path, size_t size_bytes) override; |
58 int GetEchoPath(void* echo_path, size_t size_bytes) const override; | 63 int GetEchoPath(void* echo_path, size_t size_bytes) const override; |
59 | 64 |
60 size_t num_handles_required() const; | |
61 | |
62 void AllocateRenderQueue(); | |
63 int Configure(); | 65 int Configure(); |
64 | 66 |
65 rtc::CriticalSection* const crit_render_ ACQUIRED_BEFORE(crit_capture_); | 67 rtc::CriticalSection* const crit_render_ ACQUIRED_BEFORE(crit_capture_); |
66 rtc::CriticalSection* const crit_capture_; | 68 rtc::CriticalSection* const crit_capture_; |
67 | 69 |
68 bool enabled_ = false; | 70 bool enabled_ = false; |
69 | 71 |
70 RoutingMode routing_mode_ GUARDED_BY(crit_capture_); | 72 RoutingMode routing_mode_ GUARDED_BY(crit_capture_); |
71 bool comfort_noise_enabled_ GUARDED_BY(crit_capture_); | 73 bool comfort_noise_enabled_ GUARDED_BY(crit_capture_); |
72 unsigned char* external_echo_path_ GUARDED_BY(crit_render_) | 74 unsigned char* external_echo_path_ GUARDED_BY(crit_render_) |
73 GUARDED_BY(crit_capture_); | 75 GUARDED_BY(crit_capture_); |
74 | 76 |
75 size_t render_queue_element_max_size_ GUARDED_BY(crit_render_) | |
76 GUARDED_BY(crit_capture_); | |
77 | |
78 std::vector<int16_t> render_queue_buffer_ GUARDED_BY(crit_render_); | |
79 std::vector<int16_t> capture_queue_buffer_ GUARDED_BY(crit_capture_); | |
80 | |
81 // Lock protection not needed. | |
82 std::unique_ptr< | |
83 SwapQueue<std::vector<int16_t>, RenderQueueItemVerifier<int16_t>>> | |
84 render_signal_queue_; | |
85 | |
86 std::vector<std::unique_ptr<Canceller>> cancellers_; | 77 std::vector<std::unique_ptr<Canceller>> cancellers_; |
87 std::unique_ptr<StreamProperties> stream_properties_; | 78 std::unique_ptr<StreamProperties> stream_properties_; |
88 | 79 |
89 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(EchoControlMobileImpl); | 80 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(EchoControlMobileImpl); |
90 }; | 81 }; |
91 } // namespace webrtc | 82 } // namespace webrtc |
92 | 83 |
93 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CONTROL_MOBILE_IMPL_H_ | 84 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_CONTROL_MOBILE_IMPL_H_ |
OLD | NEW |