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

Unified Diff: media/filters/audio_renderer_algorithm_base.cc

Issue 9344002: Introduce AudioRendererAlgorithmBase::VerifyConfig. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: DVLOG level. Created 8 years, 10 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 | « media/filters/audio_renderer_algorithm_base.h ('k') | media/filters/audio_renderer_base.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/audio_renderer_algorithm_base.cc
diff --git a/media/filters/audio_renderer_algorithm_base.cc b/media/filters/audio_renderer_algorithm_base.cc
index 8bc742de683078c4eab36776ee8db8577e323df7..29bafedffaaa7293892abdb6169c9e285712ca14 100644
--- a/media/filters/audio_renderer_algorithm_base.cc
+++ b/media/filters/audio_renderer_algorithm_base.cc
@@ -47,21 +47,39 @@ AudioRendererAlgorithmBase::AudioRendererAlgorithmBase()
AudioRendererAlgorithmBase::~AudioRendererAlgorithmBase() {}
+bool AudioRendererAlgorithmBase::ValidateConfig(
+ int channels,
+ int samples_per_second,
+ int bits_per_channel) {
+ bool status = true;
+
+ if (channels <= 0 || channels > 8) {
+ DVLOG(1) << "We only support audio with between 1 and 8 channels.";
+ status = false;
+ }
+
+ if (samples_per_second <= 0 || samples_per_second > 256000) {
+ DVLOG(1) << "We only support sample rates between 1 and 256000Hz.";
+ status = false;
+ }
+
+ if (bits_per_channel != 8 && bits_per_channel != 16 &&
+ bits_per_channel != 32) {
+ DVLOG(1) << "We only support 8, 16, 32 bit audio.";
+ status = false;
+ }
+
+ return status;
+}
+
void AudioRendererAlgorithmBase::Initialize(
int channels,
int samples_per_second,
int bits_per_channel,
float initial_playback_rate,
const base::Closure& callback) {
- DCHECK_GT(channels, 0);
- DCHECK_LE(channels, 8) << "We only support <= 8 channel audio.";
- DCHECK_GT(samples_per_second, 0);
- DCHECK_LE(samples_per_second, 256000)
- << "We only support sample rates at or below 256000Hz.";
- DCHECK_GT(bits_per_channel, 0);
- DCHECK_LE(bits_per_channel, 32) << "We only support 8, 16, 32 bit audio.";
- DCHECK_EQ(bits_per_channel % 8, 0) << "We only support 8, 16, 32 bit audio.";
DCHECK(!callback.is_null());
+ DCHECK(ValidateConfig(channels, samples_per_second, bits_per_channel));
channels_ = channels;
samples_per_second_ = samples_per_second;
« no previous file with comments | « media/filters/audio_renderer_algorithm_base.h ('k') | media/filters/audio_renderer_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698