Chromium Code Reviews| Index: chrome/browser/chromeos/audio_mixer_alsa.cc |
| diff --git a/chrome/browser/chromeos/audio_mixer_alsa.cc b/chrome/browser/chromeos/audio_mixer_alsa.cc |
| index 34fb722ab0e51b9ad098568e9949764a95a530d4..ca99065d4b093635bdd59826ab884a05eb3d59e6 100644 |
| --- a/chrome/browser/chromeos/audio_mixer_alsa.cc |
| +++ b/chrome/browser/chromeos/audio_mixer_alsa.cc |
| @@ -175,8 +175,6 @@ void AudioMixerAlsa::SetMute(bool mute) { |
| } |
| SetElementMuted_Locked(elem_master_, mute); |
| - if (elem_pcm_) |
| - SetElementMuted_Locked(elem_pcm_, mute); |
|
davejcool
2011/03/03 20:05:02
It turns out the PCM mixer element does have a mut
|
| prefs_->SetInteger(prefs::kAudioMute, mute ? kPrefMuteOn : kPrefMuteOff); |
| } |
| @@ -246,6 +244,21 @@ bool AudioMixerAlsa::InitializeAlsaMixer() { |
| snd_mixer_t* handle = NULL; |
| const char* card = "default"; |
| + // Verify PCM can be opened, which also instantiates the PCM mixer element |
| + // which is needed for finer volume control and for muting by setting to zero. |
| + // If it fails, we can still try to use the mixer as best we can. |
| + snd_pcm_t* pcm_out_handle; |
| + if ((err = snd_pcm_open(&pcm_out_handle, |
| + "default", |
| + SND_PCM_STREAM_PLAYBACK, |
| + 0)) >= 0) { |
| + snd_pcm_close(pcm_out_handle); |
| + } |
| + else |
| + { |
| + LOG(WARNING) << "ALSA PCM open: " << snd_strerror(err); |
| + } |
| + |
| if ((err = snd_mixer_open(&handle, 0)) < 0) { |
| LOG(ERROR) << "ALSA mixer " << card << " open error: " << snd_strerror(err); |
| return false; |
| @@ -348,8 +361,6 @@ void AudioMixerAlsa::DoSetVolumeMute(double pref_volume, int pref_mute) { |
| } |
| SetElementMuted_Locked(elem_master_, mute); |
| - if (elem_pcm_) |
| - SetElementMuted_Locked(elem_pcm_, mute); |
| } |
| void AudioMixerAlsa::RestoreVolumeMuteOnUIThread() { |