summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-20 01:03:37 +0000
committerajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-20 01:03:37 +0000
commit6f4650eac2f29b1960bd6a3dd52124f919519067 (patch)
tree4d6dfda41b129480b77b108e06f75853a88c8692 /media
parent5c292e2238cbcb8d1bd5f8f604f5f430d0de77d2 (diff)
downloadchromium_src-6f4650eac2f29b1960bd6a3dd52124f919519067.zip
chromium_src-6f4650eac2f29b1960bd6a3dd52124f919519067.tar.gz
chromium_src-6f4650eac2f29b1960bd6a3dd52124f919519067.tar.bz2
Changing overstrict CHECKs to just setting the object into an invalid state.
BUG: 13287 Review URL: http://codereview.chromium.org/140033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18882 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media')
-rw-r--r--media/audio/linux/alsa_output.cc22
1 files changed, 17 insertions, 5 deletions
diff --git a/media/audio/linux/alsa_output.cc b/media/audio/linux/alsa_output.cc
index f53d855..e7dab51 100644
--- a/media/audio/linux/alsa_output.cc
+++ b/media/audio/linux/alsa_output.cc
@@ -90,15 +90,27 @@ AlsaPCMOutputStream::AlsaPCMOutputStream(const std::string& device_name,
packet_size_(0),
device_write_suspended_(true), // Start suspended.
resources_released_(false) {
- CHECK(channels_ == 2) << "Only 2-channel audio is supported right now.";
- CHECK(AudioManager::AUDIO_PCM_LINEAR == format)
- << "Only linear PCM supported.";
- CHECK(bits_per_sample % 8 == 0) << "Only allow byte-aligned samples";
-
// Reference self to avoid accidental deletion before the message loop is
// done.
AddRef();
+ // Sanity check input values.
+ if (channels_ != 2) {
+ LOG(WARNING) << "Only 2-channel audio is supported right now.";
+ state_ = STATE_ERROR;
+ }
+
+ if (AudioManager::AUDIO_PCM_LINEAR != format) {
+ LOG(WARNING) << "Only linear PCM supported.";
+ state_ = STATE_ERROR;
+ }
+
+ if (bits_per_sample % 8 != 0) {
+ // We do this explicitly just incase someone messes up the switch below.
+ LOG(WARNING) << "Only allow byte-aligned samples";
+ state_ = STATE_ERROR;
+ }
+
switch (bits_per_sample) {
case 8:
pcm_format_ = SND_PCM_FORMAT_S8;