| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 | |
| OLD | NEW |