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

Side by Side Diff: media/audio/mac/audio_output_mac.cc

Issue 275022: Move Alsa device opening into the audio thread, and add in support for multi-channel audio. (Closed)
Patch Set: Fix up the unittests since we not only downmix for a very small set of channels. Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/audio/linux/audio_manager_linux.cc ('k') | media/base/media_switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/audio/mac/audio_manager_mac.h" 5 #include "media/audio/mac/audio_manager_mac.h"
6 #include "media/audio/mac/audio_output_mac.h" 6 #include "media/audio/mac/audio_output_mac.h"
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "media/audio/audio_util.h" 10 #include "media/audio/audio_util.h"
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 if (!audio_queue_) 164 if (!audio_queue_)
165 return; 165 return;
166 *left_level = volume_; 166 *left_level = volume_;
167 *right_level = volume_; 167 *right_level = volume_;
168 } 168 }
169 169
170 // Reorder PCM from AAC layout to Core Audio layout. 170 // Reorder PCM from AAC layout to Core Audio layout.
171 // TODO(fbarchard): Switch layout when ffmpeg is updated. 171 // TODO(fbarchard): Switch layout when ffmpeg is updated.
172 namespace { 172 namespace {
173 template<class Format> 173 template<class Format>
174 static void SwizzleLayout(Format *b, size_t filled) { 174 static void SwizzleLayout(Format* b, size_t filled) {
175 static const int kNumSurroundChannels = 6; 175 static const int kNumSurroundChannels = 6;
176 Format aac[kNumSurroundChannels]; 176 Format aac[kNumSurroundChannels];
177 for (size_t i = 0; i < filled; i += sizeof(aac), b += kNumSurroundChannels) { 177 for (size_t i = 0; i < filled; i += sizeof(aac), b += kNumSurroundChannels) {
178 memcpy(aac, b, sizeof(aac)); 178 memcpy(aac, b, sizeof(aac));
179 b[0] = aac[1]; // L 179 b[0] = aac[1]; // L
180 b[1] = aac[2]; // R 180 b[1] = aac[2]; // R
181 b[2] = aac[0]; // C 181 b[2] = aac[0]; // C
182 b[3] = aac[5]; // LFE 182 b[3] = aac[5]; // LFE
183 b[4] = aac[3]; // Ls 183 b[4] = aac[3]; // Ls
184 b[5] = aac[4]; // Rs 184 b[5] = aac[4]; // Rs
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 HandleError(err); 267 HandleError(err);
268 return; 268 return;
269 } 269 }
270 } 270 }
271 err = AudioQueueStart(audio_queue_, NULL); 271 err = AudioQueueStart(audio_queue_, NULL);
272 if (err != noErr) { 272 if (err != noErr) {
273 HandleError(err); 273 HandleError(err);
274 return; 274 return;
275 } 275 }
276 } 276 }
277
OLDNEW
« no previous file with comments | « media/audio/linux/audio_manager_linux.cc ('k') | media/base/media_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698