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_GAIN_CONTROL_IMPL_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_GAIN_CONTROL_IMPL_H_ |
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_GAIN_CONTROL_IMPL_H_ | 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_GAIN_CONTROL_IMPL_H_ |
13 | 13 |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "webrtc/base/scoped_ptr.h" | 16 #include "webrtc/base/scoped_ptr.h" |
| 17 #include "webrtc/base/thread_checker.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 class CriticalSectionWrapper; | 25 class CriticalSectionWrapper; |
25 | 26 |
26 class GainControlImpl : public GainControl, | 27 class GainControlImpl : public GainControl, |
27 public ProcessingComponent { | 28 public ProcessingComponent { |
28 public: | 29 public: |
29 GainControlImpl(const AudioProcessing* apm, | 30 GainControlImpl(const AudioProcessing* apm, |
30 CriticalSectionWrapper* crit); | 31 CriticalSectionWrapper* crit, |
| 32 const rtc::ThreadChecker* render_thread_checker, |
| 33 const rtc::ThreadChecker* capture_thread_checker); |
31 virtual ~GainControlImpl(); | 34 virtual ~GainControlImpl(); |
32 | 35 |
33 int ProcessRenderAudio(AudioBuffer* audio); | 36 int ProcessRenderAudio(AudioBuffer* audio); |
34 int AnalyzeCaptureAudio(AudioBuffer* audio); | 37 int AnalyzeCaptureAudio(AudioBuffer* audio); |
35 int ProcessCaptureAudio(AudioBuffer* audio); | 38 int ProcessCaptureAudio(AudioBuffer* audio); |
36 | 39 |
37 // ProcessingComponent implementation. | 40 // ProcessingComponent implementation. |
38 int Initialize() override; | 41 int Initialize() override; |
39 | 42 |
40 // GainControl implementation. | 43 // GainControl implementation. |
(...skipping 25 matching lines...) Expand all Loading... |
66 int InitializeHandle(void* handle) const override; | 69 int InitializeHandle(void* handle) const override; |
67 int ConfigureHandle(void* handle) const override; | 70 int ConfigureHandle(void* handle) const override; |
68 void DestroyHandle(void* handle) const override; | 71 void DestroyHandle(void* handle) const override; |
69 int num_handles_required() const override; | 72 int num_handles_required() const override; |
70 int GetHandleError(void* handle) const override; | 73 int GetHandleError(void* handle) const override; |
71 | 74 |
72 void AllocateRenderQueue(); | 75 void AllocateRenderQueue(); |
73 | 76 |
74 const AudioProcessing* apm_; | 77 const AudioProcessing* apm_; |
75 CriticalSectionWrapper* crit_; | 78 CriticalSectionWrapper* crit_; |
| 79 const rtc::ThreadChecker* const render_thread_checker_; |
| 80 const rtc::ThreadChecker* const capture_thread_checker_; |
76 Mode mode_; | 81 Mode mode_; |
77 int minimum_capture_level_; | 82 int minimum_capture_level_; |
78 int maximum_capture_level_; | 83 int maximum_capture_level_; |
79 bool limiter_enabled_; | 84 bool limiter_enabled_; |
80 int target_level_dbfs_; | 85 int target_level_dbfs_; |
81 int compression_gain_db_; | 86 int compression_gain_db_; |
82 std::vector<int> capture_levels_; | 87 std::vector<int> capture_levels_; |
83 int analog_capture_level_; | 88 int analog_capture_level_; |
84 bool was_analog_level_set_; | 89 bool was_analog_level_set_; |
85 bool stream_is_saturated_; | 90 bool stream_is_saturated_; |
86 | 91 |
87 size_t render_queue_element_max_size_; | 92 size_t render_queue_element_max_size_; |
88 std::vector<int16_t> render_queue_buffer_; | 93 std::vector<int16_t> render_queue_buffer_; |
89 std::vector<int16_t> capture_queue_buffer_; | 94 std::vector<int16_t> capture_queue_buffer_; |
90 rtc::scoped_ptr< | 95 rtc::scoped_ptr< |
91 SwapQueue<std::vector<int16_t>, RenderQueueItemVerifier<int16_t>>> | 96 SwapQueue<std::vector<int16_t>, RenderQueueItemVerifier<int16_t>>> |
92 render_signal_queue_; | 97 render_signal_queue_; |
93 }; | 98 }; |
94 } // namespace webrtc | 99 } // namespace webrtc |
95 | 100 |
96 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_GAIN_CONTROL_IMPL_H_ | 101 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_GAIN_CONTROL_IMPL_H_ |
OLD | NEW |