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

Unified Diff: media/audio/audio_output_resampler.cc

Issue 10910306: Reland 10952007: Pass through small buffer sizes without FIFO on Linux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 3 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/audio_output_resampler.cc
diff --git a/media/audio/audio_output_resampler.cc b/media/audio/audio_output_resampler.cc
index 73765cdf6ec821bb5ffc79a0b8fe33777d056485..496fe4f4d17c28f8233dcd1eac7142f9bf2b9831 100644
--- a/media/audio/audio_output_resampler.cc
+++ b/media/audio/audio_output_resampler.cc
@@ -199,6 +199,20 @@ AudioOutputResampler::~AudioOutputResampler() {}
void AudioOutputResampler::Initialize() {
io_ratio_ = 1;
+ double in_buffer_s = static_cast<double>(params_.frames_per_buffer()) /
+ static_cast<double>(params_.sample_rate());
+ double out_buffer_s =
+ static_cast<double>(output_params_.frames_per_buffer()) /
+ static_cast<double>(output_params_.sample_rate());
+ if (in_buffer_s != out_buffer_s) {
+ int out_buffer_size = static_cast<int>(
+ in_buffer_s * output_params_.sample_rate() + 0.5);
+ output_params_.Reset(output_params_.format(),
+ output_params_.channel_layout(),
+ output_params_.sample_rate(),
+ output_params_.bits_per_sample(),
+ out_buffer_size);
+ }
Chris Rogers 2012/09/18 17:36:29 Why do we need special logic here when we have Aud
// TODO(dalecurtis): Add channel remixing. http://crbug.com/138762
DCHECK_EQ(params_.channels(), output_params_.channels());
// Only resample or rebuffer if the input parameters don't match the output
« 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