Chromium Code Reviews| 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..981de1d0c5b09ad45de5246fd9764f0bb020b1de 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(); |
| // 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) |
|
no longer working on chromium
2014/05/26 14:20:16
I don't think you save much by excluding these mem
henrika (OOO until Aug 14)
2014/05/26 15:01:17
I copied how it was done on the output side (in th
henrika (OOO until Aug 14)
2014/05/27 07:46:36
In addition, we should really do our best to simpl
|
| + // 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); |