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

Unified Diff: media/audio/audio_output_controller.h

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 | « content/public/browser/web_contents.h ('k') | media/audio/audio_output_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/audio_output_controller.h
diff --git a/media/audio/audio_output_controller.h b/media/audio/audio_output_controller.h
index 0b02ee2bbb285f863774f872627d4a9bfdf27b26..f9e1033e0c34ee73caa4fbf8faf9e7eede78c5a4 100644
--- a/media/audio/audio_output_controller.h
+++ b/media/audio/audio_output_controller.h
@@ -9,6 +9,7 @@
#include "base/callback.h"
#include "base/memory/ref_counted.h"
#include "base/timer/timer.h"
+#include "build/build_config.h"
#include "media/audio/audio_io.h"
#include "media/audio/audio_manager.h"
#include "media/audio/audio_power_monitor.h"
@@ -51,11 +52,6 @@
//
namespace media {
-
-// Only do power monitoring for non-mobile platforms that need it for the UI.
-#if !defined(OS_ANDROID) && !defined(OS_IOS)
-#define AUDIO_POWER_MONITORING
-#endif
class MEDIA_EXPORT AudioOutputController
: public base::RefCountedThreadSafe<AudioOutputController>,
@@ -110,6 +106,16 @@
const AudioParameters& params, const std::string& output_device_id,
SyncReader* sync_reader);
+ // Indicates whether audio power level analysis will be performed. If false,
+ // ReadCurrentPowerAndClip() can not be called.
+ static bool will_monitor_audio_levels() {
+#if defined(OS_ANDROID) || defined(OS_IOS)
+ return false;
+#else
+ return true;
+#endif
+ }
+
// Methods to control playback of the stream.
// Starts the playback of this audio output stream.
@@ -178,6 +184,10 @@
kError,
};
+ // Time constant for AudioPowerMonitor. See AudioPowerMonitor ctor comments
+ // for semantics. This value was arbitrarily chosen, but seems to work well.
+ enum { kPowerMeasurementTimeConstantMillis = 10 };
+
friend class base::RefCountedThreadSafe<AudioOutputController>;
virtual ~AudioOutputController();
@@ -235,10 +245,8 @@
// The message loop of audio manager thread that this object runs on.
const scoped_refptr<base::SingleThreadTaskRunner> message_loop_;
-#if defined(AUDIO_POWER_MONITORING)
// Scans audio samples from OnMoreData() as input to compute power levels.
AudioPowerMonitor power_monitor_;
-#endif
// Flags when we've asked for a stream to start but it never did.
base::AtomicRefCount on_more_io_data_called_;
« no previous file with comments | « content/public/browser/web_contents.h ('k') | media/audio/audio_output_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698