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

Side by Side Diff: chrome/browser/chromeos/audio_mixer_alsa.cc

Issue 6321014: Save/Restore ALSA volume/mute fix (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/browser/chromeos
Patch Set: Created 9 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/chromeos/audio_mixer_alsa.h" 5 #include "chrome/browser/chromeos/audio_mixer_alsa.h"
6 6
7 #include <alsa/asoundlib.h> 7 #include <alsa/asoundlib.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/task.h" 10 #include "base/task.h"
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 if (pref_mute == kPrefMuteInvalid) 293 if (pref_mute == kPrefMuteInvalid)
294 mute = GetElementMuted_Locked(elem_master_); 294 mute = GetElementMuted_Locked(elem_master_);
295 else 295 else
296 mute = (pref_mute == kPrefMuteOn) ? true : false; 296 mute = (pref_mute == kPrefMuteOn) ? true : false;
297 297
298 VLOG(1) << "Setting volume to " << pref_volume << " and mute to " << mute; 298 VLOG(1) << "Setting volume to " << pref_volume << " and mute to " << mute;
299 299
300 if (mute) { 300 if (mute) {
301 save_volume_ = pref_volume; 301 save_volume_ = pref_volume;
302 DoSetVolumeDb_Locked(min_volume_); 302 DoSetVolumeDb_Locked(min_volume_);
303 } else if (pref_mute == kPrefMuteOff) { 303 } else {
304 DoSetVolumeDb_Locked(pref_volume); 304 DoSetVolumeDb_Locked(pref_volume);
davejcool 2011/01/21 19:29:15 This check should have been removed once I added t
scherkus (not reviewing) 2011/01/21 21:26:04 nit: indentation is off here
davejcool 2011/01/21 22:39:29 D'oh! This'll be formatted right in the next CL..
305 } 305 }
306 306
307 SetElementMuted_Locked(elem_master_, mute); 307 SetElementMuted_Locked(elem_master_, mute);
308 if (elem_pcm_) 308 if (elem_pcm_)
309 SetElementMuted_Locked(elem_pcm_, mute); 309 SetElementMuted_Locked(elem_pcm_, mute);
310 } 310 }
311 311
312 void AudioMixerAlsa::RestoreVolumeMuteOnUIThread() { 312 void AudioMixerAlsa::RestoreVolumeMuteOnUIThread() {
313 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 313 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
314 // This happens during init, so set the volume off the UI thread. 314 // This happens during init, so set the volume off the UI thread.
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 void AudioMixerAlsa::SetElementMuted_Locked(snd_mixer_elem_t* elem, bool mute) { 432 void AudioMixerAlsa::SetElementMuted_Locked(snd_mixer_elem_t* elem, bool mute) {
433 int enabled = mute ? 0 : 1; 433 int enabled = mute ? 0 : 1;
434 snd_mixer_selem_set_playback_switch_all(elem, enabled); 434 snd_mixer_selem_set_playback_switch_all(elem, enabled);
435 435
436 VLOG(1) << "Set playback switch " << snd_mixer_selem_get_name(elem) 436 VLOG(1) << "Set playback switch " << snd_mixer_selem_get_name(elem)
437 << " to " << enabled; 437 << " to " << enabled;
438 } 438 }
439 439
440 } // namespace chromeos 440 } // namespace chromeos
441 441
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698