OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 28 matching lines...) Expand all Loading... |
39 // | 39 // |
40 // This class is not thread-safe. | 40 // This class is not thread-safe. |
41 class AgcManagerDirect final { | 41 class AgcManagerDirect final { |
42 public: | 42 public: |
43 // AgcManagerDirect will configure GainControl internally. The user is | 43 // AgcManagerDirect will configure GainControl internally. The user is |
44 // responsible for processing the audio using it after the call to Process. | 44 // responsible for processing the audio using it after the call to Process. |
45 // The operating range of startup_min_level is [12, 255] and any input value | 45 // The operating range of startup_min_level is [12, 255] and any input value |
46 // outside that range will be clamped. | 46 // outside that range will be clamped. |
47 AgcManagerDirect(GainControl* gctrl, | 47 AgcManagerDirect(GainControl* gctrl, |
48 VolumeCallbacks* volume_callbacks, | 48 VolumeCallbacks* volume_callbacks, |
49 int startup_min_level); | 49 int startup_min_level, |
| 50 int clipped_level_min); |
50 // Dependency injection for testing. Don't delete |agc| as the memory is owned | 51 // Dependency injection for testing. Don't delete |agc| as the memory is owned |
51 // by the manager. | 52 // by the manager. |
52 AgcManagerDirect(Agc* agc, | 53 AgcManagerDirect(Agc* agc, |
53 GainControl* gctrl, | 54 GainControl* gctrl, |
54 VolumeCallbacks* volume_callbacks, | 55 VolumeCallbacks* volume_callbacks, |
55 int startup_min_level); | 56 int startup_min_level, |
| 57 int clipped_level_min); |
56 ~AgcManagerDirect(); | 58 ~AgcManagerDirect(); |
57 | 59 |
58 int Initialize(); | 60 int Initialize(); |
59 void AnalyzePreProcess(int16_t* audio, | 61 void AnalyzePreProcess(int16_t* audio, |
60 int num_channels, | 62 int num_channels, |
61 size_t samples_per_channel); | 63 size_t samples_per_channel); |
62 void Process(const int16_t* audio, size_t length, int sample_rate_hz); | 64 void Process(const int16_t* audio, size_t length, int sample_rate_hz); |
63 | 65 |
64 // Call when the capture stream has been muted/unmuted. This causes the | 66 // Call when the capture stream has been muted/unmuted. This causes the |
65 // manager to disregard all incoming audio; chances are good it's background | 67 // manager to disregard all incoming audio; chances are good it's background |
(...skipping 25 matching lines...) Expand all Loading... |
91 int level_; | 93 int level_; |
92 int max_level_; | 94 int max_level_; |
93 int max_compression_gain_; | 95 int max_compression_gain_; |
94 int target_compression_; | 96 int target_compression_; |
95 int compression_; | 97 int compression_; |
96 float compression_accumulator_; | 98 float compression_accumulator_; |
97 bool capture_muted_; | 99 bool capture_muted_; |
98 bool check_volume_on_next_process_; | 100 bool check_volume_on_next_process_; |
99 bool startup_; | 101 bool startup_; |
100 int startup_min_level_; | 102 int startup_min_level_; |
| 103 const int clipped_level_min_; |
101 | 104 |
102 std::unique_ptr<DebugFile> file_preproc_; | 105 std::unique_ptr<DebugFile> file_preproc_; |
103 std::unique_ptr<DebugFile> file_postproc_; | 106 std::unique_ptr<DebugFile> file_postproc_; |
104 | 107 |
105 RTC_DISALLOW_COPY_AND_ASSIGN(AgcManagerDirect); | 108 RTC_DISALLOW_COPY_AND_ASSIGN(AgcManagerDirect); |
106 }; | 109 }; |
107 | 110 |
108 } // namespace webrtc | 111 } // namespace webrtc |
109 | 112 |
110 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AGC_AGC_MANAGER_DIRECT_H_ | 113 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AGC_AGC_MANAGER_DIRECT_H_ |
OLD | NEW |