Index: media/audio/mac/audio_low_latency_output_mac.cc |
diff --git a/media/audio/mac/audio_low_latency_output_mac.cc b/media/audio/mac/audio_low_latency_output_mac.cc |
index e63477630c119a260b1449f4c7f26856c7b80897..eb8eb1c74d769eb98713fac561029995b2ac777b 100644 |
--- a/media/audio/mac/audio_low_latency_output_mac.cc |
+++ b/media/audio/mac/audio_low_latency_output_mac.cc |
@@ -11,7 +11,22 @@ |
#include "media/audio/audio_util.h" |
#include "media/audio/mac/audio_manager_mac.h" |
-using media::SwizzleCoreAudioLayout5_1; |
+// Reorder PCM from AAC layout to Core Audio 5.1 layout. |
+// TODO(fbarchard): Switch layout when ffmpeg is updated. |
+template<class Format> |
+static void SwizzleCoreAudioLayout5_1(Format* b, uint32 filled) { |
+ static const int kNumSurroundChannels = 6; |
+ Format aac[kNumSurroundChannels]; |
+ for (uint32 i = 0; i < filled; i += sizeof(aac), b += kNumSurroundChannels) { |
+ memcpy(aac, b, sizeof(aac)); |
+ b[0] = aac[1]; // L |
+ b[1] = aac[2]; // R |
+ b[2] = aac[0]; // C |
+ b[3] = aac[5]; // LFE |
+ b[4] = aac[3]; // Ls |
+ b[5] = aac[4]; // Rs |
+ } |
+} |
// Overview of operation: |
// 1) An object of AUAudioOutputStream is created by the AudioManager |