| Index: media/audio/audio_power_monitor.cc
|
| diff --git a/media/audio/audio_power_monitor.cc b/media/audio/audio_power_monitor.cc
|
| index 6536f464b9c16905e7d4080a907b5a4df5678acf..b0b17971b4fa63d8e34700bfec75ab13c5d6a21a 100644
|
| --- a/media/audio/audio_power_monitor.cc
|
| +++ b/media/audio/audio_power_monitor.cc
|
| @@ -26,8 +26,17 @@ AudioPowerMonitor::~AudioPowerMonitor() {
|
| }
|
|
|
| void AudioPowerMonitor::Reset() {
|
| - power_reading_ = average_power_ = 0.0f;
|
| - clipped_reading_ = has_clipped_ = false;
|
| + // These are only read/written by Scan(), but Scan() should not be running
|
| + // when Reset() is called.
|
| + average_power_ = 0.0f;
|
| + has_clipped_ = false;
|
| +
|
| + // These are the copies read by ReadCurrentPowerAndClip(). The lock here is
|
| + // not necessary, as racey writes/reads are acceptable, but this prevents
|
| + // quality-enhancement tools like TSAN from complaining.
|
| + base::AutoLock for_reset(reading_lock_);
|
| + power_reading_ = 0.0f;
|
| + clipped_reading_ = false;
|
| }
|
|
|
| void AudioPowerMonitor::Scan(const AudioBus& buffer, int num_frames) {
|
|
|