From b6458fe22082ec5f3e746467569f1ca70308c89a Mon Sep 17 00:00:00 2001 From: "fbarchard@chromium.org" Date: Fri, 9 Oct 2009 18:24:27 +0000 Subject: Support 8 and 32 bit formats for Mac Channel Swizzler. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=28484 Review URL: http://codereview.chromium.org/261028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28571 0039d316-1c4b-4281-b951-d872f2087c98 --- media/audio/mac/audio_output_mac.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'media') diff --git a/media/audio/mac/audio_output_mac.cc b/media/audio/mac/audio_output_mac.cc index ecd0d1c..a8f34f3 100644 --- a/media/audio/mac/audio_output_mac.cc +++ b/media/audio/mac/audio_output_mac.cc @@ -169,9 +169,10 @@ void PCMQueueOutAudioOutputStream::GetVolume(double* left_level, // Reorder PCM from AAC layout to Core Audio layout. // TODO(fbarchard): Switch layout when ffmpeg is updated. -const int kNumSurroundChannels = 6; +namespace { template static void SwizzleLayout(Format *b, size_t filled) { + static const int kNumSurroundChannels = 6; Format aac[kNumSurroundChannels]; for (size_t i = 0; i < filled; i += sizeof(aac), b += kNumSurroundChannels) { memcpy(aac, b, sizeof(aac)); @@ -183,6 +184,7 @@ static void SwizzleLayout(Format *b, size_t filled) { b[5] = aac[4]; // Rs } } +} // namespace // Note to future hackers of this function: Do not add locks here because we // call out to third party source that might do crazy things including adquire @@ -218,7 +220,7 @@ void PCMQueueOutAudioOutputStream::RenderCallback(void* p_this, return; } - // Handle channel order for PCM 5.1 audio. + // Handle channel order for 5.1 audio. if (audio_stream->format_.mChannelsPerFrame == 6) { if (audio_stream->format_.mBitsPerChannel == 8) { SwizzleLayout(reinterpret_cast(buffer->mAudioData), filled); -- cgit v1.1