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

Unified Diff: media/base/audio_buffer_converter.cc

Issue 245523002: Merge 264918 "Fix the output request size for AudioBufferConvert..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1916/src/
Patch Set: Created 6 years, 8 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/base/audio_buffer_converter.h ('k') | media/base/audio_buffer_converter_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/audio_buffer_converter.cc
===================================================================
--- media/base/audio_buffer_converter.cc (revision 265022)
+++ media/base/audio_buffer_converter.cc (working copy)
@@ -145,11 +145,12 @@
0,
buffer->sample_rate(),
input_params_.bits_per_sample(),
- // This is arbitrary, but small buffer sizes result in a lot of tiny
- // ProvideInput calls, so we'll use at least the SincResampler's default
- // request size.
- std::max(buffer->frame_count(),
- static_cast<int>(SincResampler::kDefaultRequestSize)));
+ // If resampling is needed and the FIFO disabled, the AudioConverter will
+ // always request SincResampler::kDefaultRequestSize frames. Otherwise it
+ // will use the output frame size.
+ buffer->sample_rate() == output_params_.sample_rate()
+ ? output_params_.frames_per_buffer()
+ : SincResampler::kDefaultRequestSize);
io_sample_rate_ratio_ = static_cast<double>(input_params_.sample_rate()) /
output_params_.sample_rate();
@@ -159,6 +160,7 @@
if (!IsConfigChange(output_params_, buffer))
return;
+ // Note: The FIFO is disabled to avoid extraneous memcpy().
audio_converter_.reset(
new AudioConverter(input_params_, output_params_, true));
audio_converter_->AddInput(this);
« no previous file with comments | « media/base/audio_buffer_converter.h ('k') | media/base/audio_buffer_converter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698