Index: media/audio/audio_output_controller.cc |
diff --git a/media/audio/audio_output_controller.cc b/media/audio/audio_output_controller.cc |
index fb01254568adebb5b56baa9cb421dcc0940716ca..45d308db3effd64f12394570200c1f90b515ea4f 100644 |
--- a/media/audio/audio_output_controller.cc |
+++ b/media/audio/audio_output_controller.cc |
@@ -16,12 +16,6 @@ |
using base::TimeDelta; |
namespace media { |
- |
-#if defined(AUDIO_POWER_MONITORING) |
-// Time constant for AudioPowerMonitor. See AudioPowerMonitor ctor comments for |
-// semantics. This value was arbitrarily chosen, but seems to work well. |
-static const int kPowerMeasurementTimeConstantMillis = 10; |
-#endif |
AudioOutputController::AudioOutputController( |
AudioManager* audio_manager, |
@@ -39,11 +33,9 @@ |
state_(kEmpty), |
sync_reader_(sync_reader), |
message_loop_(audio_manager->GetTaskRunner()), |
-#if defined(AUDIO_POWER_MONITORING) |
power_monitor_( |
params.sample_rate(), |
TimeDelta::FromMilliseconds(kPowerMeasurementTimeConstantMillis)), |
-#endif |
on_more_io_data_called_(0) { |
DCHECK(audio_manager); |
DCHECK(handler_); |
@@ -200,11 +192,9 @@ |
wedge_timer_.reset(); |
stream_->Stop(); |
-#if defined(AUDIO_POWER_MONITORING) |
// A stopped stream is silent, and power_montior_.Scan() is no longer being |
// called; so we must reset the power monitor. |
power_monitor_.Reset(); |
-#endif |
state_ = kPaused; |
} |
@@ -306,9 +296,8 @@ |
sync_reader_->UpdatePendingBytes( |
buffers_state.total_bytes() + frames * params_.GetBytesPerFrame()); |
-#if defined(AUDIO_POWER_MONITORING) |
- power_monitor_.Scan(*dest, frames); |
-#endif |
+ if (will_monitor_audio_levels()) |
+ power_monitor_.Scan(*dest, frames); |
return frames; |
} |
@@ -412,12 +401,8 @@ |
} |
std::pair<float, bool> AudioOutputController::ReadCurrentPowerAndClip() { |
-#if defined(AUDIO_POWER_MONITORING) |
+ DCHECK(will_monitor_audio_levels()); |
return power_monitor_.ReadCurrentPowerAndClip(); |
-#else |
- NOTREACHED(); |
- return std::make_pair(AudioPowerMonitor::zero_power(), false); |
-#endif |
} |
void AudioOutputController::WedgeCheck() { |