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 <memory> | 14 #include <memory> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "webrtc/base/constructormagic.h" | 17 #include "webrtc/base/constructormagic.h" |
18 #include "webrtc/base/criticalsection.h" | 18 #include "webrtc/base/criticalsection.h" |
19 #include "webrtc/base/swap_queue.h" | 19 #include "webrtc/base/swap_queue.h" |
20 #include "webrtc/base/thread_annotations.h" | 20 #include "webrtc/base/thread_annotations.h" |
21 #include "webrtc/modules/audio_processing/include/audio_processing.h" | 21 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
22 #include "webrtc/modules/audio_processing/render_queue_item_verifier.h" | 22 #include "webrtc/modules/audio_processing/render_queue_item_verifier.h" |
23 | 23 |
24 namespace webrtc { | 24 namespace webrtc { |
25 | 25 |
| 26 class ApmDataDumper; |
26 class AudioBuffer; | 27 class AudioBuffer; |
27 | 28 |
28 class GainControlImpl : public GainControl { | 29 class GainControlImpl : public GainControl { |
29 public: | 30 public: |
30 GainControlImpl(rtc::CriticalSection* crit_render, | 31 GainControlImpl(rtc::CriticalSection* crit_render, |
31 rtc::CriticalSection* crit_capture); | 32 rtc::CriticalSection* crit_capture); |
32 ~GainControlImpl() override; | 33 ~GainControlImpl() override; |
33 | 34 |
34 void ProcessRenderAudio(rtc::ArrayView<const int16_t> packed_render_audio); | 35 void ProcessRenderAudio(rtc::ArrayView<const int16_t> packed_render_audio); |
35 int AnalyzeCaptureAudio(AudioBuffer* audio); | 36 int AnalyzeCaptureAudio(AudioBuffer* audio); |
(...skipping 26 matching lines...) Expand all Loading... |
62 int set_analog_level_limits(int minimum, int maximum) override; | 63 int set_analog_level_limits(int minimum, int maximum) override; |
63 int analog_level_minimum() const override; | 64 int analog_level_minimum() const override; |
64 int analog_level_maximum() const override; | 65 int analog_level_maximum() const override; |
65 bool stream_is_saturated() const override; | 66 bool stream_is_saturated() const override; |
66 | 67 |
67 int Configure(); | 68 int Configure(); |
68 | 69 |
69 rtc::CriticalSection* const crit_render_ ACQUIRED_BEFORE(crit_capture_); | 70 rtc::CriticalSection* const crit_render_ ACQUIRED_BEFORE(crit_capture_); |
70 rtc::CriticalSection* const crit_capture_; | 71 rtc::CriticalSection* const crit_capture_; |
71 | 72 |
| 73 std::unique_ptr<ApmDataDumper> data_dumper_; |
| 74 |
72 bool enabled_ = false; | 75 bool enabled_ = false; |
73 | 76 |
74 Mode mode_ GUARDED_BY(crit_capture_); | 77 Mode mode_ GUARDED_BY(crit_capture_); |
75 int minimum_capture_level_ GUARDED_BY(crit_capture_); | 78 int minimum_capture_level_ GUARDED_BY(crit_capture_); |
76 int maximum_capture_level_ GUARDED_BY(crit_capture_); | 79 int maximum_capture_level_ GUARDED_BY(crit_capture_); |
77 bool limiter_enabled_ GUARDED_BY(crit_capture_); | 80 bool limiter_enabled_ GUARDED_BY(crit_capture_); |
78 int target_level_dbfs_ GUARDED_BY(crit_capture_); | 81 int target_level_dbfs_ GUARDED_BY(crit_capture_); |
79 int compression_gain_db_ GUARDED_BY(crit_capture_); | 82 int compression_gain_db_ GUARDED_BY(crit_capture_); |
80 int analog_capture_level_ GUARDED_BY(crit_capture_); | 83 int analog_capture_level_ GUARDED_BY(crit_capture_); |
81 bool was_analog_level_set_ GUARDED_BY(crit_capture_); | 84 bool was_analog_level_set_ GUARDED_BY(crit_capture_); |
82 bool stream_is_saturated_ GUARDED_BY(crit_capture_); | 85 bool stream_is_saturated_ GUARDED_BY(crit_capture_); |
83 | 86 |
84 std::vector<std::unique_ptr<GainController>> gain_controllers_; | 87 std::vector<std::unique_ptr<GainController>> gain_controllers_; |
85 | 88 |
86 rtc::Optional<size_t> num_proc_channels_ GUARDED_BY(crit_capture_); | 89 rtc::Optional<size_t> num_proc_channels_ GUARDED_BY(crit_capture_); |
87 rtc::Optional<int> sample_rate_hz_ GUARDED_BY(crit_capture_); | 90 rtc::Optional<int> sample_rate_hz_ GUARDED_BY(crit_capture_); |
88 | 91 |
| 92 static int instance_counter_; |
89 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(GainControlImpl); | 93 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(GainControlImpl); |
90 }; | 94 }; |
91 } // namespace webrtc | 95 } // namespace webrtc |
92 | 96 |
93 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_GAIN_CONTROL_IMPL_H_ | 97 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_GAIN_CONTROL_IMPL_H_ |
OLD | NEW |