Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Unified Diff: media/audio/linux/alsa_output.cc

Issue 140033: Changing overstrict CHECKs to just setting the object into an invalid state. (Closed)
Patch Set: Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/audio/linux/alsa_output.cc
diff --git a/media/audio/linux/alsa_output.cc b/media/audio/linux/alsa_output.cc
index f53d855d08cac1cc2a53176a51d31bb5941359cd..e7dab513f77e892f23df3fe1030f137860bdcbe0 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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698