diff options
author | wtc <wtc@chromium.org> | 2015-01-16 17:27:29 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-17 01:28:29 +0000 |
commit | 8ce46c7881a3296187c7dd27afb581f84f4b27a7 (patch) | |
tree | 982f0d2a5c7af89ee809749d2689cf5a4fc8b8ec /media/audio | |
parent | 1bcdf89e7c5379dbe65f5a844e2c949f8f536016 (diff) | |
download | chromium_src-8ce46c7881a3296187c7dd27afb581f84f4b27a7.zip chromium_src-8ce46c7881a3296187c7dd27afb581f84f4b27a7.tar.gz chromium_src-8ce46c7881a3296187c7dd27afb581f84f4b27a7.tar.bz2 |
Reorder channels to match ALSA's channel order.
R=dalecurtis@chromium.org
BUG=none
Review URL: https://codereview.chromium.org/807573006
Cr-Commit-Position: refs/heads/master@{#312003}
Diffstat (limited to 'media/audio')
-rw-r--r-- | media/audio/alsa/alsa_output.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/media/audio/alsa/alsa_output.cc b/media/audio/alsa/alsa_output.cc index 08ce39a..9cb279e 100644 --- a/media/audio/alsa/alsa_output.cc +++ b/media/audio/alsa/alsa_output.cc @@ -375,6 +375,25 @@ void AlsaPcmOutputStream::BufferPacket(bool* source_exhausted) { packet_size = packet_size / bytes_per_frame_ * bytes_per_output_frame_; } + // Reorder channels for 5.0, 5.1, and 7.1 to match ALSA's channel order, + // which has front center at channel index 4 and LFE at channel index 5. + // See http://ffmpeg.org/pipermail/ffmpeg-cvslog/2011-June/038454.html. + switch (channel_layout_) { + case media::CHANNEL_LAYOUT_5_0: + case media::CHANNEL_LAYOUT_5_0_BACK: + output_bus->SwapChannels(2, 3); + output_bus->SwapChannels(3, 4); + break; + case media::CHANNEL_LAYOUT_5_1: + case media::CHANNEL_LAYOUT_5_1_BACK: + case media::CHANNEL_LAYOUT_7_1: + output_bus->SwapChannels(2, 4); + output_bus->SwapChannels(3, 5); + break; + default: + break; + } + // Note: If this ever changes to output raw float the data must be clipped // and sanitized since it may come from an untrusted source such as NaCl. output_bus->Scale(volume_); |