summaryrefslogtreecommitdiffstats
path: root/media/audio/linux/alsa_wrapper.h
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.h
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.h')
-rw-r--r--media/audio/linux/alsa_wrapper.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/media/audio/linux/alsa_wrapper.h b/media/audio/linux/alsa_wrapper.h
index d7686dd..5ab3c84 100644
--- a/media/audio/linux/alsa_wrapper.h
+++ b/media/audio/linux/alsa_wrapper.h
@@ -15,6 +15,10 @@ class AlsaWrapper {
AlsaWrapper();
virtual ~AlsaWrapper();
+ virtual int DeviceNameHint(int card, const char* iface, void*** hints);
+ virtual char* DeviceNameGetHint(const void* hint, const char* id);
+ virtual int DeviceNameFreeHint(void** hints);
+
virtual int PcmOpen(snd_pcm_t** handle, const char* name,
snd_pcm_stream_t stream, int mode);
virtual int PcmClose(snd_pcm_t* handle);