Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1254)

Unified Diff: media/audio/audio_output_controller.cc

Issue 569713002: Revert of Gardening: Revert "Use AudioStreamMonitor to control power save blocking." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/audio/audio_output_controller.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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() {
« no previous file with comments | « media/audio/audio_output_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698