summaryrefslogtreecommitdiffstats
path: root/media/audio/linux/alsa_wrapper.cc
diff options
context:
space:
mode:
authorajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-16 18:41:56 +0000
committerajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-16 18:41:56 +0000
commit713b99db0f33455c019968d6ff890e9830ebd4f0 (patch)
treeeefc378f9c6a469a25ad1d1653fac72e906bb6a1 /media/audio/linux/alsa_wrapper.cc
parent4576ba04a833ea439f6dd034eeced33b24c898e9 (diff)
downloadchromium_src-713b99db0f33455c019968d6ff890e9830ebd4f0.zip
chromium_src-713b99db0f33455c019968d6ff890e9830ebd4f0.tar.gz
chromium_src-713b99db0f33455c019968d6ff890e9830ebd4f0.tar.bz2
Move Alsa device opening into the audio thread, and add in support for multi-channel audio.
Moving the device opening into the audio thread will prevent browser hangs for badly behaving alsa implementations (like pulseaudio) that can hang snd_pcm_open if pulseaudiod is wedged, even if SND_PCM_NONBLOCK is requested. For multi-channel audio, device enumeration has been added to try and find a multi-channel device with a stable channel mapping. According to http://0pointer.de/blog/projects/guide-to-sound-apis.html, default should only be used with mono and stereo stream because the channel ordering is not defined by Alsa. To get a well-defined channel ordering, one must use one of the surround40, surround51, etc., device names. However, these device names do not always allow multiple opens, so a fallback scheme is implemented to use default if necessary. BUG=20945,17703 TEST=listened with built-in soundcard and USB soundcard with various other audio programs running. Review URL: http://codereview.chromium.org/275022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29299 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio/linux/alsa_wrapper.cc')
-rw-r--r--media/audio/linux/alsa_wrapper.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/media/audio/linux/alsa_wrapper.cc b/media/audio/linux/alsa_wrapper.cc
index 8463686..303a1f1 100644
--- a/media/audio/linux/alsa_wrapper.cc
+++ b/media/audio/linux/alsa_wrapper.cc
@@ -17,6 +17,18 @@ int AlsaWrapper::PcmOpen(snd_pcm_t** handle, const char* name,
return snd_pcm_open(handle, name, stream, mode);
}
+int AlsaWrapper::DeviceNameHint(int card, const char* iface, void*** hints) {
+ return snd_device_name_hint(card, iface, hints);
+}
+
+char* AlsaWrapper::DeviceNameGetHint(const void* hint, const char* id) {
+ return snd_device_name_get_hint(hint, id);
+}
+
+int AlsaWrapper::DeviceNameFreeHint(void** hints) {
+ return snd_device_name_free_hint(hints);
+}
+
int AlsaWrapper::PcmClose(snd_pcm_t* handle) {
return snd_pcm_close(handle);
}