OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_AUDIO_AGC_AUDIO_STREAM_H_ | 5 #ifndef MEDIA_AUDIO_AGC_AUDIO_STREAM_H_ |
6 #define MEDIA_AUDIO_AGC_AUDIO_STREAM_H_ | 6 #define MEDIA_AUDIO_AGC_AUDIO_STREAM_H_ |
7 | 7 |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/synchronization/lock.h" | 10 #include "base/synchronization/lock.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 base::AutoLock auto_lock(lock_); | 173 base::AutoLock auto_lock(lock_); |
174 normalized_volume_ = normalized_volume; | 174 normalized_volume_ = normalized_volume; |
175 } | 175 } |
176 } | 176 } |
177 | 177 |
178 // Ensures that this class is created and destroyed on the same thread. | 178 // Ensures that this class is created and destroyed on the same thread. |
179 base::ThreadChecker thread_checker_; | 179 base::ThreadChecker thread_checker_; |
180 | 180 |
181 // Repeating timer which cancels itself when it goes out of scope. | 181 // Repeating timer which cancels itself when it goes out of scope. |
182 // Used to check the microphone volume periodically. | 182 // Used to check the microphone volume periodically. |
183 base::RepeatingTimer<AgcAudioStream<AudioInterface> > timer_; | 183 base::RepeatingTimer timer_; |
184 | 184 |
185 // True when automatic gain control is enabled, false otherwise. | 185 // True when automatic gain control is enabled, false otherwise. |
186 bool agc_is_enabled_; | 186 bool agc_is_enabled_; |
187 | 187 |
188 // Stores the maximum volume which is used for normalization to a volume | 188 // Stores the maximum volume which is used for normalization to a volume |
189 // range of [0.0, 1.0]. | 189 // range of [0.0, 1.0]. |
190 double max_volume_; | 190 double max_volume_; |
191 | 191 |
192 // Contains last result of internal call to GetVolume(). We save resources | 192 // Contains last result of internal call to GetVolume(). We save resources |
193 // by not querying the capture volume for each callback. Guarded by |lock_|. | 193 // by not querying the capture volume for each callback. Guarded by |lock_|. |
194 // The range is normalized to [0.0, 1.0]. | 194 // The range is normalized to [0.0, 1.0]. |
195 double normalized_volume_; | 195 double normalized_volume_; |
196 | 196 |
197 // Protects |normalized_volume_| . | 197 // Protects |normalized_volume_| . |
198 base::Lock lock_; | 198 base::Lock lock_; |
199 | 199 |
200 DISALLOW_COPY_AND_ASSIGN(AgcAudioStream<AudioInterface>); | 200 DISALLOW_COPY_AND_ASSIGN(AgcAudioStream<AudioInterface>); |
201 }; | 201 }; |
202 | 202 |
203 } // namespace media | 203 } // namespace media |
204 | 204 |
205 #endif // MEDIA_AUDIO_AGC_AUDIO_STREAM_H_ | 205 #endif // MEDIA_AUDIO_AGC_AUDIO_STREAM_H_ |
OLD | NEW |