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_; |