diff options
author | fbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-05 09:59:31 +0000 |
---|---|---|
committer | fbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-05 09:59:31 +0000 |
commit | 9c2b65c90863f3623759cbd05b75dce2482f34cd (patch) | |
tree | 8bf0d9dafba1ba5c9af2e4f2756b8f0b34d84c9e /media | |
parent | cdf24783452995438d30d78c558379e82ae636d0 (diff) | |
download | chromium_src-9c2b65c90863f3623759cbd05b75dce2482f34cd.zip chromium_src-9c2b65c90863f3623759cbd05b75dce2482f34cd.tar.gz chromium_src-9c2b65c90863f3623759cbd05b75dce2482f34cd.tar.bz2 |
Limit frequency of audio to 48000.
BUG=24480
TEST=Play colors2.ogv and do a seek. Should play and seek but audio will be mute.
Review URL: http://codereview.chromium.org/365010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31084 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r-- | media/audio/linux/alsa_output.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/media/audio/linux/alsa_output.cc b/media/audio/linux/alsa_output.cc index f6091a8..1ee85e7 100644 --- a/media/audio/linux/alsa_output.cc +++ b/media/audio/linux/alsa_output.cc @@ -112,6 +112,10 @@ const int AlsaPcmOutputStream::kMinLatencyMicros = namespace { +// ALSA is currently limited to 48Khz. +// TODO(fbarchard): Resample audio from higher frequency to 48000. +const int kMaxSampleRate = 48000; + snd_pcm_format_t BitsToFormat(char bits_per_sample) { switch (bits_per_sample) { case 8: @@ -257,6 +261,11 @@ AlsaPcmOutputStream::AlsaPcmOutputStream(const std::string& device_name, message_loop_(message_loop) { // Sanity check input values. + if ((sample_rate > kMaxSampleRate) || (sample_rate <= 0)) { + LOG(WARNING) << "Unsupported audio frequency."; + shared_data_.TransitionTo(kInError); + } + if (AudioManager::AUDIO_PCM_LINEAR != format) { LOG(WARNING) << "Only linear PCM supported."; shared_data_.TransitionTo(kInError); |