summaryrefslogtreecommitdiffstats
path: root/media/audio/audio_output_controller_unittest.cc
diff options
context:
space:
mode:
authorannacc@chromium.org <annacc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-16 22:18:32 +0000
committerannacc@chromium.org <annacc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-16 22:18:32 +0000
commitb630cb97c620593f9c987fdad0b3271ddbf39a3e (patch)
tree21295811329d31b302e29be7e16198fdfd5bc463 /media/audio/audio_output_controller_unittest.cc
parent99d22e8b1c2c0b6f6457147ab90ce2df98ef02d3 (diff)
downloadchromium_src-b630cb97c620593f9c987fdad0b3271ddbf39a3e.zip
chromium_src-b630cb97c620593f9c987fdad0b3271ddbf39a3e.tar.gz
chromium_src-b630cb97c620593f9c987fdad0b3271ddbf39a3e.tar.bz2
Description:
This patch gets the channel layout for surround sound channel order from ffmpeg and stores it so that chromium will be able to re-order the channels for various sound cards and OSes later. - AudioParameters gets a new field (channel_layout). - channel_layout.h stores an enum that we will use in chromium for channel values. - ffmpeg_common.h gets a new method for mapping the channel layout received from ffmpeg to an internal chromium enum value. BUG=None (though storing the channel order should help us solve some other bugs soon) TEST=media_unittests Review URL: http://codereview.chromium.org/6930039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85541 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio/audio_output_controller_unittest.cc')
-rw-r--r--media/audio/audio_output_controller_unittest.cc20
1 files changed, 10 insertions, 10 deletions
diff --git a/media/audio/audio_output_controller_unittest.cc b/media/audio/audio_output_controller_unittest.cc
index 2cf936b..0f94ae5 100644
--- a/media/audio/audio_output_controller_unittest.cc
+++ b/media/audio/audio_output_controller_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -20,10 +20,10 @@ using ::testing::Return;
static const int kSampleRate = AudioParameters::kAudioCDSampleRate;
static const int kBitsPerSample = 16;
-static const int kChannels = 2;
+static const ChannelLayout kChannelLayout = CHANNEL_LAYOUT_STEREO;
static const int kSamplesPerPacket = kSampleRate / 10;
-static const int kHardwareBufferSize = kSamplesPerPacket * kChannels *
- kBitsPerSample / 8;
+static const int kHardwareBufferSize = kSamplesPerPacket *
+ ChannelLayoutToChannelCount(kChannelLayout) * kBitsPerSample / 8;
static const int kBufferCapacity = 3 * kHardwareBufferSize;
namespace media {
@@ -97,7 +97,7 @@ TEST(AudioOutputControllerTest, CreateAndClose) {
.Times(1);
EXPECT_CALL(event_handler, OnMoreData(NotNull(), _));
- AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR, kChannels,
+ AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR, kChannelLayout,
kSampleRate, kBitsPerSample, kSamplesPerPacket);
scoped_refptr<AudioOutputController> controller =
AudioOutputController::Create(&event_handler, params, kBufferCapacity);
@@ -127,7 +127,7 @@ TEST(AudioOutputControllerTest, PlayAndClose) {
.Times(AtLeast(10))
.WillRepeatedly(SignalEvent(&event));
- AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR, kChannels,
+ AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR, kChannelLayout,
kSampleRate, kBitsPerSample, kSamplesPerPacket);
scoped_refptr<AudioOutputController> controller =
AudioOutputController::Create(&event_handler, params, kBufferCapacity);
@@ -176,7 +176,7 @@ TEST(AudioOutputControllerTest, PlayPauseClose) {
.Times(Exactly(1))
.WillOnce(InvokeWithoutArgs(&pause_event, &base::WaitableEvent::Signal));
- AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR, kChannels,
+ AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR, kChannelLayout,
kSampleRate, kBitsPerSample, kSamplesPerPacket);
scoped_refptr<AudioOutputController> controller =
AudioOutputController::Create(&event_handler, params, kBufferCapacity);
@@ -236,7 +236,7 @@ TEST(AudioOutputControllerTest, PlayPausePlay) {
.Times(Exactly(1))
.RetiresOnSaturation();
- AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR, kChannels,
+ AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR, kChannelLayout,
kSampleRate, kBitsPerSample, kSamplesPerPacket);
scoped_refptr<AudioOutputController> controller =
AudioOutputController::Create(&event_handler, params, kBufferCapacity);
@@ -279,7 +279,7 @@ TEST(AudioOutputControllerTest, HardwareBufferTooLarge) {
// Create an audio device with a very large hardware buffer size.
MockAudioOutputControllerEventHandler event_handler;
- AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR, kChannels,
+ AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR, kChannelLayout,
kSampleRate, kBitsPerSample,
kSamplesPerPacket * 1000);
scoped_refptr<AudioOutputController> controller =
@@ -307,7 +307,7 @@ TEST(AudioOutputControllerTest, CloseTwice) {
.Times(AtLeast(1))
.WillRepeatedly(SignalEvent(&event));
- AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR, kChannels,
+ AudioParameters params(AudioParameters::AUDIO_PCM_LINEAR, kChannelLayout,
kSampleRate, kBitsPerSample, kSamplesPerPacket);
scoped_refptr<AudioOutputController> controller =
AudioOutputController::Create(&event_handler, params, kBufferCapacity);