| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <cmath> | 7 #include <cmath> |
| 8 #include <unistd.h> | 8 #include <unistd.h> |
| 9 | 9 |
| 10 #include <alsa/asoundlib.h> | 10 #include <alsa/asoundlib.h> |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 base::AutoLock lock(mixer_state_lock_); | 191 base::AutoLock lock(mixer_state_lock_); |
| 192 // If we think it's ready, verify it is actually so. | 192 // If we think it's ready, verify it is actually so. |
| 193 if ((mixer_state_ == READY) && (alsa_mixer_ == NULL)) | 193 if ((mixer_state_ == READY) && (alsa_mixer_ == NULL)) |
| 194 mixer_state_ = IN_ERROR; | 194 mixer_state_ = IN_ERROR; |
| 195 return mixer_state_; | 195 return mixer_state_; |
| 196 } | 196 } |
| 197 | 197 |
| 198 // static | 198 // static |
| 199 void AudioMixerAlsa::RegisterPrefs(PrefService* local_state) { | 199 void AudioMixerAlsa::RegisterPrefs(PrefService* local_state) { |
| 200 if (!local_state->FindPreference(prefs::kAudioVolume)) | 200 if (!local_state->FindPreference(prefs::kAudioVolume)) |
| 201 local_state->RegisterDoublePref(prefs::kAudioVolume, kPrefVolumeInvalid); | 201 local_state->RegisterDoublePref(prefs::kAudioVolume, |
| 202 kPrefVolumeInvalid, |
| 203 PrefService::UNSYNCABLE_PREF); |
| 202 if (!local_state->FindPreference(prefs::kAudioMute)) | 204 if (!local_state->FindPreference(prefs::kAudioMute)) |
| 203 local_state->RegisterIntegerPref(prefs::kAudioMute, kPrefMuteInvalid); | 205 local_state->RegisterIntegerPref(prefs::kAudioMute, |
| 206 kPrefMuteInvalid, |
| 207 PrefService::UNSYNCABLE_PREF); |
| 204 } | 208 } |
| 205 | 209 |
| 206 //////////////////////////////////////////////////////////////////////////////// | 210 //////////////////////////////////////////////////////////////////////////////// |
| 207 // Private functions follow | 211 // Private functions follow |
| 208 | 212 |
| 209 void AudioMixerAlsa::DoInit(InitDoneCallback* callback) { | 213 void AudioMixerAlsa::DoInit(InitDoneCallback* callback) { |
| 210 bool success = false; | 214 bool success = false; |
| 211 for (int num_attempts = 0; num_attempts < kMaxInitAttempts; ++num_attempts) { | 215 for (int num_attempts = 0; num_attempts < kMaxInitAttempts; ++num_attempts) { |
| 212 success = InitializeAlsaMixer(); | 216 success = InitializeAlsaMixer(); |
| 213 if (success) { | 217 if (success) { |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 if (alsa_result != 0) { | 552 if (alsa_result != 0) { |
| 549 LOG(WARNING) << "snd_mixer_selem_set_playback_switch_all() failed: " | 553 LOG(WARNING) << "snd_mixer_selem_set_playback_switch_all() failed: " |
| 550 << snd_strerror(alsa_result); | 554 << snd_strerror(alsa_result); |
| 551 } else { | 555 } else { |
| 552 VLOG(1) << "Set playback switch " << snd_mixer_selem_get_name(elem) | 556 VLOG(1) << "Set playback switch " << snd_mixer_selem_get_name(elem) |
| 553 << " to " << enabled; | 557 << " to " << enabled; |
| 554 } | 558 } |
| 555 } | 559 } |
| 556 | 560 |
| 557 } // namespace chromeos | 561 } // namespace chromeos |
| OLD | NEW |