| Index: media/audio/audio_input_controller.h
|
| diff --git a/media/audio/audio_input_controller.h b/media/audio/audio_input_controller.h
|
| index 3facfb511d18670a4a6d2ce0e0f19071099fe0e8..35ec1b77fc72f8f527093e7345da2af5d4f40499 100644
|
| --- a/media/audio/audio_input_controller.h
|
| +++ b/media/audio/audio_input_controller.h
|
| @@ -16,6 +16,9 @@
|
| #include "base/timer/timer.h"
|
| #include "media/audio/audio_io.h"
|
| #include "media/audio/audio_manager_base.h"
|
| +#include "media/audio/audio_parameters.h"
|
| +#include "media/audio/audio_power_monitor.h"
|
| +#include "media/base/audio_bus.h"
|
|
|
| // An AudioInputController controls an AudioInputStream and records data
|
| // from this input stream. The two main methods are Record() and Close() and
|
| @@ -72,6 +75,11 @@
|
| //
|
| namespace media {
|
|
|
| +// Only do power monitoring for non-mobile platforms to save resources.
|
| +#if !defined(OS_ANDROID) && !defined(OS_IOS)
|
| +#define AUDIO_POWER_MONITORING
|
| +#endif
|
| +
|
| class UserInputMonitor;
|
|
|
| class MEDIA_EXPORT AudioInputController
|
| @@ -111,6 +119,8 @@ class MEDIA_EXPORT AudioInputController
|
| ErrorCode error_code) = 0;
|
| virtual void OnData(AudioInputController* controller, const uint8* data,
|
| uint32 size) = 0;
|
| + virtual void OnLog(AudioInputController* controller,
|
| + const std::string& message) = 0;
|
|
|
| protected:
|
| virtual ~EventHandler() {}
|
| @@ -252,6 +262,7 @@ class MEDIA_EXPORT AudioInputController
|
| void DoSetVolume(double volume);
|
| void DoSetAutomaticGainControl(bool enabled);
|
| void DoOnData(scoped_ptr<uint8[]> data, uint32 size);
|
| + void DoLogAudioLevel(float level_dbfs);
|
|
|
| // Method to check if we get recorded data after a stream was started,
|
| // and log the result to UMA.
|
| @@ -309,6 +320,16 @@ class MEDIA_EXPORT AudioInputController
|
|
|
| UserInputMonitor* user_input_monitor_;
|
|
|
| +#if defined(AUDIO_POWER_MONITORING)
|
| + // Scans audio samples from OnData() as input to compute audio levels.
|
| + scoped_ptr<AudioPowerMonitor> audio_level_;
|
| +
|
| + // We need these to be able to feed data to the AudioPowerMonitor.
|
| + scoped_ptr<AudioBus> audio_bus_;
|
| + media::AudioParameters audio_params_;
|
| + base::TimeTicks last_audio_level_log_time_;
|
| +#endif
|
| +
|
| size_t prev_key_down_count_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(AudioInputController);
|
|
|