OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_AUDIO_POWER_MONITOR_H_ | 5 #ifndef MEDIA_AUDIO_AUDIO_POWER_MONITOR_H_ |
6 #define MEDIA_AUDIO_AUDIO_POWER_MONITOR_H_ | 6 #define MEDIA_AUDIO_AUDIO_POWER_MONITOR_H_ |
7 | 7 |
8 #include <limits> | 8 #include <limits> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/macros.h" |
12 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
13 #include "media/base/media_export.h" | 14 #include "media/base/media_export.h" |
14 | 15 |
15 // An audio signal power monitor. It is periodically provided an AudioBus by | 16 // An audio signal power monitor. It is periodically provided an AudioBus by |
16 // the native audio thread, and the audio samples in each channel are analyzed | 17 // the native audio thread, and the audio samples in each channel are analyzed |
17 // to determine the average power of the signal over a time period. Here | 18 // to determine the average power of the signal over a time period. Here |
18 // "average power" is a running average calculated by using a first-order | 19 // "average power" is a running average calculated by using a first-order |
19 // low-pass filter over the square of the samples scanned. Whenever reporting | 20 // low-pass filter over the square of the samples scanned. Whenever reporting |
20 // the power level, this running average is converted to dBFS (decibels relative | 21 // the power level, this running average is converted to dBFS (decibels relative |
21 // to full-scale) units. | 22 // to full-scale) units. |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 base::Lock reading_lock_; | 79 base::Lock reading_lock_; |
79 float power_reading_; | 80 float power_reading_; |
80 bool clipped_reading_; | 81 bool clipped_reading_; |
81 | 82 |
82 DISALLOW_COPY_AND_ASSIGN(AudioPowerMonitor); | 83 DISALLOW_COPY_AND_ASSIGN(AudioPowerMonitor); |
83 }; | 84 }; |
84 | 85 |
85 } // namespace media | 86 } // namespace media |
86 | 87 |
87 #endif // MEDIA_AUDIO_AUDIO_POWER_MONITOR_H_ | 88 #endif // MEDIA_AUDIO_AUDIO_POWER_MONITOR_H_ |
OLD | NEW |