Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Unified Diff: media/audio/audio_input_controller.h

Issue 2919793002: Detect AudioInputStream muting and propagate to MediaStreamAudioSource. (Closed)
Patch Set: Reworked test again, to make tsan2 happy. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/pepper/pepper_platform_audio_input.cc ('k') | media/audio/audio_input_controller.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/audio_input_controller.h
diff --git a/media/audio/audio_input_controller.h b/media/audio/audio_input_controller.h
index 8b717053298eb16892ae4542c79d3cf161347335..b037996870da6af6af536c4909c07776d61f4803 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,9 @@ class MEDIA_EXPORT AudioInputController
// Time when the stream started recording.
base::TimeTicks stream_create_time_;
+ bool is_muted_ = false;
+ base::RepeatingTimer check_muted_state_timer_;
+
#if BUILDFLAG(ENABLE_WEBRTC)
// Used for audio debug recordings. Accessed on audio thread.
AudioDebugRecordingHelper debug_recording_helper_;
« no previous file with comments | « content/renderer/pepper/pepper_platform_audio_input.cc ('k') | media/audio/audio_input_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698