Chromium Code Reviews| 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" |
| @@ -52,11 +53,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>, |
| public AudioOutputStream::AudioSourceCallback, |
| @@ -110,6 +106,16 @@ class MEDIA_EXPORT AudioOutputController |
| 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 @@ class MEDIA_EXPORT AudioOutputController |
| 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 @@ class MEDIA_EXPORT AudioOutputController |
| // 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. |
|
miu
2014/09/05 18:20:25
Not sure whether I agree with taking things this f
DaleCurtis
2014/09/05 18:30:14
I was hoping the compiler would be smart enough to
|
| 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_; |