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

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: Created 8 years, 4 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
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..e532ae25e0e437ca2ea965099b52a51ebc2fa31c 100644
--- a/chrome/browser/chromeos/audio/audio_mixer_alsa.h
+++ b/chrome/browser/chromeos/audio/audio_mixer_alsa.h
@@ -33,6 +33,12 @@ class AudioMixerAlsa : public AudioMixer {
virtual void SetVolumePercent(double percent) OVERRIDE;
virtual bool IsMuted() OVERRIDE;
virtual void SetMuted(bool muted) 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,7 @@ class AudioMixerAlsa : public AudioMixer {
double DbToPercent(double db) const;
double PercentToDb(double percent) const;
- // Guards |min_volume_db_|, |max_volume_db_|, |volume_db_|, |is_muted_|,
+ // Guards |min_volume_db_|, |max_volume_db_|, |volume_db_|, the mute state,
Mattias Nissler (ping if slow) 2012/08/28 12:24:24 I'd just list the additional members for clarity.
pastarmovj 2012/08/28 15:11:50 Done.
// |apply_is_pending_|, and |initial_volume_percent_|.
base::Lock lock_;
@@ -88,8 +94,13 @@ class AudioMixerAlsa : public AudioMixer {
// volume is updated later on |thread_| by ApplyState().
double volume_db_;
- // Most recently-requested muting state.
+ // Most recently-requested muting state. We don't have control over ALSA so
+ // other sound clients might unmute channels but we can do best effort to
+ // mimic CRASes locking functionality.
Daniel Erat 2012/08/27 17:38:35 nit: s/CRASes/CRAS's/
pastarmovj 2012/08/28 15:11:50 Done.
bool is_muted_;
+ bool is_mute_locked_;
Daniel Erat 2012/08/27 17:38:35 nit: move is_mute_locked_ and is_capture_mute_lock
pastarmovj 2012/08/28 15:11:50 Done.
+ bool is_capture_muted_;
+ bool is_capture_mute_locked_;
// Is there already a pending call to ApplyState() scheduled on |thread_|?
bool apply_is_pending_;
@@ -109,6 +120,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.
Mattias Nissler (ping if slow) 2012/08/28 12:24:24 nit: Two spaces after period seems to be the rule
pastarmovj 2012/08/28 15:11:50 Done.
+ _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_;

Powered by Google App Engine
This is Rietveld 408576698