summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordavej@chromium.org <davej@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-05 02:06:57 +0000
committerdavej@chromium.org <davej@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-05 02:06:57 +0000
commit9ad63d2ad848efdda29deef7ce65e6d286d2d478 (patch)
tree0ccd38d1895f3cda392b9f9a75d0a8d502ea4ebf
parentbac4f4b0d49057c75c362dc1bad6ee955b0d0c7e (diff)
downloadchromium_src-9ad63d2ad848efdda29deef7ce65e6d286d2d478.zip
chromium_src-9ad63d2ad848efdda29deef7ce65e6d286d2d478.tar.gz
chromium_src-9ad63d2ad848efdda29deef7ce65e6d286d2d478.tar.bz2
Cros: Check PCM after opening Alsa mixer
Alsa is logging numerous messages in the buildbot Linux Builder (Chromium OS) logs when trying to open a PCM stream after CL 6591095. This block of code was moved down to run only after successfully attaching to the Alsa mixer. BUG=chromium-os:12151 TEST=none Review URL: http://codereview.chromium.org/6621026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@77021 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chromeos/audio_mixer_alsa.cc28
1 files changed, 13 insertions, 15 deletions
diff --git a/chrome/browser/chromeos/audio_mixer_alsa.cc b/chrome/browser/chromeos/audio_mixer_alsa.cc
index ca99065..a84ffeb 100644
--- a/chrome/browser/chromeos/audio_mixer_alsa.cc
+++ b/chrome/browser/chromeos/audio_mixer_alsa.cc
@@ -244,21 +244,6 @@ 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;
@@ -271,6 +256,19 @@ bool AudioMixerAlsa::InitializeAlsaMixer() {
return false;
}
+ // 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,
+ card,
+ 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_selem_register(handle, NULL, NULL)) < 0) {
LOG(ERROR) << "ALSA mixer register error: " << snd_strerror(err);
snd_mixer_close(handle);