Index: media/audio/audio_input_controller.h |
diff --git a/media/audio/audio_input_controller.h b/media/audio/audio_input_controller.h |
index ff0022dbee32629e567ac114d657a84d00728bb3..a56f4db368ff3b5e3c3869679cf4e0e813085c3a 100644 |
--- a/media/audio/audio_input_controller.h |
+++ b/media/audio/audio_input_controller.h |
@@ -13,7 +13,9 @@ |
#include "base/files/file.h" |
#include "base/memory/weak_ptr.h" |
+#include "base/optional.h" |
#include "base/single_thread_task_runner.h" |
+#include "base/timer/timer.h" |
#include "media/audio/audio_debug_file_writer.h" |
#include "media/audio/audio_io.h" |
#include "media/audio/audio_manager_base.h" |
@@ -107,6 +109,11 @@ class MEDIA_EXPORT AudioInputController |
ErrorCode error_code) = 0; |
virtual void OnLog(AudioInputController* controller, |
const std::string& message) = 0; |
+ // Initially, an AudioInputController is considered not muted. If the |
+ // underlying stream is actually muted, an OnMuted callback will follow |
+ // shortly after OnCreated. It is also called whenever the muted state of |
+ // the underlying stream changes. |
+ virtual void OnMuted(AudioInputController* controller, bool is_muted) = 0; |
protected: |
virtual ~EventHandler() {} |
@@ -323,6 +330,8 @@ class MEDIA_EXPORT AudioInputController |
float* average_power_dbfs, |
int* mic_volume_percent); |
+ void CheckMutedState(); |
+ |
static StreamType ParamsToStreamType(const AudioParameters& params); |
// Gives access to the task runner of the creating thread. |
@@ -367,6 +376,12 @@ class MEDIA_EXPORT AudioInputController |
// Time when the stream started recording. |
base::TimeTicks stream_create_time_; |
+ bool is_muted_ = false; |
+ |
+ // The timer needs to be destroyed on the correct thread, so we can't leave |
+ // that to our destructor. |
+ base::Optional<base::RepeatingTimer> check_muted_state_timer_; |
DaleCurtis
2017/06/15 18:44:00
Drop Optional in favor of just IsRunning().
ossu-chromium
2017/06/20 12:25:15
I was quite sure I was unable to get the timer to
|
+ |
#if BUILDFLAG(ENABLE_WEBRTC) |
// Used for audio debug recordings. Accessed on audio thread. |
AudioDebugRecordingHelper debug_recording_helper_; |