summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorfbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-09 18:24:27 +0000
committerfbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-09 18:24:27 +0000
commitb6458fe22082ec5f3e746467569f1ca70308c89a (patch)
tree74c9fa410324c4c4ede5459b2886c9bc7dc74204 /media
parent90f9811b35a731351bff8fe61f9d427d108d7465 (diff)
downloadchromium_src-b6458fe22082ec5f3e746467569f1ca70308c89a.zip
chromium_src-b6458fe22082ec5f3e746467569f1ca70308c89a.tar.gz
chromium_src-b6458fe22082ec5f3e746467569f1ca70308c89a.tar.bz2
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
Diffstat (limited to 'media')
-rw-r--r--media/audio/mac/audio_output_mac.cc6
1 files changed, 4 insertions, 2 deletions
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<class Format>
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<uint8*>(buffer->mAudioData), filled);