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

Unified Diff: media/audio/pulse/pulse_input.h

Issue 645923002: Add support for audio input mute detection on all platforms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 6 years, 2 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 | « media/audio/mac/audio_low_latency_input_mac.cc ('k') | media/audio/pulse/pulse_input.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/pulse/pulse_input.h
diff --git a/media/audio/pulse/pulse_input.h b/media/audio/pulse/pulse_input.h
index 60acf2f908719891974eee38326fe528b64d615d..dd42b31489ef0f1cc4e25082eb75ecc556e336a4 100644
--- a/media/audio/pulse/pulse_input.h
+++ b/media/audio/pulse/pulse_input.h
@@ -5,6 +5,7 @@
#ifndef MEDIA_AUDIO_PULSE_PULSE_INPUT_H_
#define MEDIA_AUDIO_PULSE_PULSE_INPUT_H_
+#include <pulse/pulseaudio.h>
#include <string>
#include "base/threading/thread_checker.h"
@@ -14,11 +15,6 @@
#include "media/audio/audio_parameters.h"
#include "media/base/audio_block_fifo.h"
-struct pa_context;
-struct pa_source_info;
-struct pa_stream;
-struct pa_threaded_mainloop;
-
namespace media {
class AudioManagerPulse;
@@ -41,6 +37,7 @@ class PulseAudioInputStream : public AgcAudioStream<AudioInputStream> {
virtual double GetMaxVolume() override;
virtual void SetVolume(double volume) override;
virtual double GetVolume() override;
+ virtual bool IsMuted() override;
private:
// PulseAudio Callbacks.
@@ -48,10 +45,17 @@ class PulseAudioInputStream : public AgcAudioStream<AudioInputStream> {
static void StreamNotifyCallback(pa_stream* stream, void* user_data);
static void VolumeCallback(pa_context* context, const pa_source_info* info,
int error, void* user_data);
+ static void MuteCallback(pa_context* context,
+ const pa_source_info* info,
+ int error,
+ void* user_data);
// Helper for the ReadCallback.
void ReadData();
+ // Utility method used by GetVolume() and IsMuted().
+ bool GetSourceInformation(pa_source_info_cb_t callback);
+
AudioManagerPulse* audio_manager_;
AudioInputCallback* callback_;
std::string device_name_;
@@ -60,6 +64,10 @@ class PulseAudioInputStream : public AgcAudioStream<AudioInputStream> {
double volume_;
bool stream_started_;
+ // Set to true in IsMuted() if user has muted the selected microphone in the
+ // sound settings UI.
+ bool muted_;
+
// Holds the data from the OS.
AudioBlockFifo fifo_;
« no previous file with comments | « media/audio/mac/audio_low_latency_input_mac.cc ('k') | media/audio/pulse/pulse_input.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698