Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(236)

Issue 275022: Move Alsa device opening into the audio thread, and add in support for multi-channel audio. (Closed)

Created:
11 years, 2 months ago by awong
Modified:
9 years, 7 months ago
CC:
chromium-reviews_googlegroups.com
Visibility:
Public.

Description

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.

Patch Set 1 #

Patch Set 2 : Fixes up packet scheduling for multi-channel. #

Total comments: 29

Patch Set 3 : Unittests, plus command-line driven switches. #

Total comments: 3

Patch Set 4 : Fix down-mixing and channel swizzling. #

Total comments: 18

Patch Set 5 : Address andrew's comments. #

Total comments: 1

Patch Set 6 : Fix up the unittests since we not only downmix for a very small set of channels. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+694 lines, -121 lines) Patch
M media/audio/linux/alsa_output.h View 1 2 3 5 chunks +34 lines, -6 lines 0 comments Download
M media/audio/linux/alsa_output.cc View 1 2 3 4 5 15 chunks +320 lines, -68 lines 0 comments Download
M media/audio/linux/alsa_output_unittest.cc View 1 2 3 4 5 12 chunks +275 lines, -35 lines 0 comments Download
M media/audio/linux/alsa_wrapper.h View 1 chunk +4 lines, -0 lines 0 comments Download
M media/audio/linux/alsa_wrapper.cc View 1 chunk +12 lines, -0 lines 0 comments Download
M media/audio/linux/audio_manager_linux.cc View 1 2 2 chunks +10 lines, -8 lines 0 comments Download
M media/audio/mac/audio_output_mac.cc View 2 chunks +1 line, -2 lines 0 comments Download
A media/base/media_switches.h View 3 1 chunk +20 lines, -0 lines 0 comments Download
A media/base/media_switches.cc View 3 1 chunk +14 lines, -0 lines 0 comments Download
M media/media.gyp View 1 chunk +4 lines, -2 lines 0 comments Download

Messages

Total messages: 13 (0 generated)
awong
This gets us much closer to correct multi-channel in Alsa. We still need to swizzle ...
11 years, 2 months ago (2009-10-15 01:40:56 UTC) #1
fbarchard
LGTM - the multichannel/volume looks fine. It looks like it has limitations - like you ...
11 years, 2 months ago (2009-10-15 02:31:19 UTC) #2
scherkus (not reviewing)
nits http://codereview.chromium.org/275022/diff/1001/1002 File media/audio/linux/alsa_output.cc (right): http://codereview.chromium.org/275022/diff/1001/1002#newcode98 Line 98: static const int kMinLatencyMicros = kSleepErrorMilliseconds * ...
11 years, 2 months ago (2009-10-15 03:13:48 UTC) #3
awong
Fixed the comments, and also added unittests plus a command-line flag to manually specify an ...
11 years, 2 months ago (2009-10-15 23:57:01 UTC) #4
scherkus (not reviewing)
LGTM with nits http://codereview.chromium.org/275022/diff/1001/1002 File media/audio/linux/alsa_output.cc (right): http://codereview.chromium.org/275022/diff/1001/1002#newcode546 Line 546: next_fill_time_ms /= channels_ / 2; ...
11 years, 2 months ago (2009-10-16 00:08:11 UTC) #5
awong
Once more! Turns out that it wasn't just my comment that was out of date...the ...
11 years, 2 months ago (2009-10-16 01:27:27 UTC) #6
scherkus (not reviewing)
http://codereview.chromium.org/275022/diff/7003/7004 File media/audio/linux/alsa_output.cc (right): http://codereview.chromium.org/275022/diff/7003/7004#newcode176 Line 176: static void Swizzle50Layout(Format *b, size_t filled) { pointer ...
11 years, 2 months ago (2009-10-16 01:44:34 UTC) #7
Alpha Left Google
I see this is failing media_unittests, is this being taken care of yet?
11 years, 2 months ago (2009-10-16 01:47:16 UTC) #8
awong
http://codereview.chromium.org/275022/diff/7003/7004 File media/audio/linux/alsa_output.cc (right): http://codereview.chromium.org/275022/diff/7003/7004#newcode176 Line 176: static void Swizzle50Layout(Format *b, size_t filled) { On ...
11 years, 2 months ago (2009-10-16 01:49:33 UTC) #9
scherkus (not reviewing)
LGTM! http://codereview.chromium.org/275022/diff/7003/7004 File media/audio/linux/alsa_output.cc (right): http://codereview.chromium.org/275022/diff/7003/7004#newcode617 Line 617: (frames_leftover > 0) ? frames_leftover : frames_per_packet_; ...
11 years, 2 months ago (2009-10-16 01:56:08 UTC) #10
awong
And for Alpha...test fixes. :)
11 years, 2 months ago (2009-10-16 02:13:25 UTC) #11
scherkus (not reviewing)
LGTM
11 years, 2 months ago (2009-10-16 03:25:18 UTC) #12
fbarchard
11 years, 2 months ago (2009-10-16 15:52:13 UTC) #13
LGTM.  Concerns for future work (todo?)
1. does not deal well with multiple movies.  devices will conflict
2. does not deal with changing of device part way thru a movie.
3. will need more work for channels and bit depths (same as other drivers)

Powered by Google App Engine
This is Rietveld 408576698