diff options
author | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-20 18:51:04 +0000 |
---|---|---|
committer | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-20 18:51:04 +0000 |
commit | ee55459f7479ba545f79d1222d543c43e4203fc3 (patch) | |
tree | 2971168b17cf297b9c842b5bbbb7cc9c655507f5 /media/audio | |
parent | 230388a45910240cd770cd5a29a39bad4ca19ce4 (diff) | |
download | chromium_src-ee55459f7479ba545f79d1222d543c43e4203fc3.zip chromium_src-ee55459f7479ba545f79d1222d543c43e4203fc3.tar.gz chromium_src-ee55459f7479ba545f79d1222d543c43e4203fc3.tar.bz2 |
Enabled mono playback support for Linux.
BUG=19788
TEST=try playing any mono audio source, should just work!
Review URL: http://codereview.chromium.org/173109
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23846 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio')
-rw-r--r-- | media/audio/linux/alsa_output.cc | 10 | ||||
-rw-r--r-- | media/audio/linux/alsa_output_unittest.cc | 15 |
2 files changed, 20 insertions, 5 deletions
diff --git a/media/audio/linux/alsa_output.cc b/media/audio/linux/alsa_output.cc index 4f02318..d0fda06 100644 --- a/media/audio/linux/alsa_output.cc +++ b/media/audio/linux/alsa_output.cc @@ -167,9 +167,13 @@ AlsaPcmOutputStream::AlsaPcmOutputStream(const std::string& device_name, message_loop_(message_loop) { // Sanity check input values. - // TODO(ajwong): Just try what happens if we allow non 2-channel audio. - if (channels_ != 2) { - LOG(WARNING) << "Only 2-channel audio is supported right now."; + // + // TODO(scherkus): ALSA works fine if you pass in multichannel audio, however + // it seems to be mapped to the wrong channels. We may have to do some + // channel swizzling from decoder output to ALSA's preferred multichannel + // format. + if (channels_ != 1 && channels_ != 2) { + LOG(WARNING) << "Only 1 and 2 channel audio is supported right now."; shared_data_.TransitionTo(kInError); } diff --git a/media/audio/linux/alsa_output_unittest.cc b/media/audio/linux/alsa_output_unittest.cc index b215b3a..917c79f 100644 --- a/media/audio/linux/alsa_output_unittest.cc +++ b/media/audio/linux/alsa_output_unittest.cc @@ -108,10 +108,21 @@ TEST_F(AlsaPcmOutputStreamTest, ConstructedState) { EXPECT_EQ(AlsaPcmOutputStream::kCreated, test_stream_->shared_data_.state()); - // Only supports 2 channel. + // Should support mono. test_stream_ = new AlsaPcmOutputStream(kTestDeviceName, kTestFormat, - kTestChannels + 1, + 1, // Channels. + kTestSampleRate, + kTestBitsPerSample, + &mock_alsa_wrapper_, + &message_loop_); + EXPECT_EQ(AlsaPcmOutputStream::kCreated, + test_stream_->shared_data_.state()); + + // Should not support multi-channel. + test_stream_ = new AlsaPcmOutputStream(kTestDeviceName, + kTestFormat, + 3, // Channels. kTestSampleRate, kTestBitsPerSample, &mock_alsa_wrapper_, |