summaryrefslogtreecommitdiffstats
path: root/media/audio/mac/audio_output_mac.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/mac/audio_output_mac.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/mac/audio_output_mac.cc')
-rw-r--r--media/audio/mac/audio_output_mac.cc3
1 files changed, 1 insertions, 2 deletions
diff --git a/media/audio/mac/audio_output_mac.cc b/media/audio/mac/audio_output_mac.cc
index a8f34f3..42e80a1 100644
--- a/media/audio/mac/audio_output_mac.cc
+++ b/media/audio/mac/audio_output_mac.cc
@@ -171,7 +171,7 @@ void PCMQueueOutAudioOutputStream::GetVolume(double* left_level,
// TODO(fbarchard): Switch layout when ffmpeg is updated.
namespace {
template<class Format>
-static void SwizzleLayout(Format *b, size_t filled) {
+static void SwizzleLayout(Format* b, size_t filled) {
static const int kNumSurroundChannels = 6;
Format aac[kNumSurroundChannels];
for (size_t i = 0; i < filled; i += sizeof(aac), b += kNumSurroundChannels) {
@@ -274,4 +274,3 @@ void PCMQueueOutAudioOutputStream::Start(AudioSourceCallback* callback) {
return;
}
}
-