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

Unified Diff: chrome/browser/chromeos/audio/audio_mixer_alsa.h

Issue 10873085: Implement two new policies to control muting the audio I/O. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased to ToT. Created 8 years, 3 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 | « chrome/browser/chromeos/audio/audio_mixer.h ('k') | chrome/browser/chromeos/audio/audio_mixer_alsa.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/audio/audio_mixer_alsa.h
diff --git a/chrome/browser/chromeos/audio/audio_mixer_alsa.h b/chrome/browser/chromeos/audio/audio_mixer_alsa.h
index 215e86fcde181664bd73e1dc126d2bb80f6491c0..c954d2ef3b258ac96ac00c0dd9207c54bffb59da 100644
--- a/chrome/browser/chromeos/audio/audio_mixer_alsa.h
+++ b/chrome/browser/chromeos/audio/audio_mixer_alsa.h
@@ -32,7 +32,13 @@ class AudioMixerAlsa : public AudioMixer {
virtual double GetVolumePercent() OVERRIDE;
virtual void SetVolumePercent(double percent) OVERRIDE;
virtual bool IsMuted() OVERRIDE;
- virtual void SetMuted(bool muted) OVERRIDE;
+ virtual void SetMuted(bool mute) OVERRIDE;
+ virtual bool IsMuteLocked() OVERRIDE;
+ virtual void SetMuteLocked(bool locked) OVERRIDE;
+ virtual bool IsCaptureMuted() OVERRIDE;
+ virtual void SetCaptureMuted(bool mute) OVERRIDE;
+ virtual bool IsCaptureMuteLocked() OVERRIDE;
+ virtual void SetCaptureMuteLocked(bool locked) OVERRIDE;
private:
// Tries to connect to ALSA. On failure, posts a delayed Connect() task to
@@ -75,7 +81,12 @@ class AudioMixerAlsa : public AudioMixer {
double DbToPercent(double db) const;
double PercentToDb(double percent) const;
+ // Calls ApplyState on the proper thread only if no other call is currently
+ // pending.
+ void ApplyStateIfNeeded();
+
// Guards |min_volume_db_|, |max_volume_db_|, |volume_db_|, |is_muted_|,
+ // |is_mute_locked_|, |is_capture_muted_|, |is_capture_mute_locked_|,
// |apply_is_pending_|, and |initial_volume_percent_|.
base::Lock lock_;
@@ -90,6 +101,14 @@ class AudioMixerAlsa : public AudioMixer {
// Most recently-requested muting state.
bool is_muted_;
+ bool is_capture_muted_;
+
+ // If set to true the mute state of the respective channel is locked and can
+ // not be changed until it is unlocked. We don't have control over ALSA so
+ // other sound clients might unmute channels but we can do best effort to
+ // mimic CRAS's locking functionality.
+ bool is_mute_locked_;
+ bool is_capture_mute_locked_;
// Is there already a pending call to ApplyState() scheduled on |thread_|?
bool apply_is_pending_;
@@ -109,6 +128,10 @@ class AudioMixerAlsa : public AudioMixer {
// PCM mixer. May be NULL if the driver doesn't expose one.
_snd_mixer_elem* pcm_element_;
+ // Mic mixers. Used to mute capture. Both might be NULL on some drivers.
+ _snd_mixer_elem* mic_element_;
+ _snd_mixer_elem* front_mic_element_;
+
// Signalled after Disconnect() finishes (which is itself invoked by the
// d'tor).
base::WaitableEvent disconnected_event_;
« no previous file with comments | « chrome/browser/chromeos/audio/audio_mixer.h ('k') | chrome/browser/chromeos/audio/audio_mixer_alsa.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698