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

Unified Diff: media/filters/null_audio_renderer.cc

Issue 155695: Replace the guts of AudioRendererBase with calls to scaling algorithm. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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/null_audio_renderer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/null_audio_renderer.cc
===================================================================
--- media/filters/null_audio_renderer.cc (revision 22189)
+++ media/filters/null_audio_renderer.cc (working copy)
@@ -15,8 +15,7 @@
static const size_t kBufferSizeInMilliseconds = 100;
NullAudioRenderer::NullAudioRenderer()
- : AudioRendererBase(kDefaultMaxQueueSize),
- playback_rate_(0.0f),
+ : AudioRendererBase(),
bytes_per_millisecond_(0),
buffer_size_(0),
thread_(NULL),
@@ -36,10 +35,6 @@
return ParseMediaFormat(media_format, &channels, &sample_rate, &sample_bits);
}
-void NullAudioRenderer::SetPlaybackRate(float playback_rate) {
- playback_rate_ = playback_rate;
-}
-
void NullAudioRenderer::SetVolume(float volume) {
// Do nothing.
}
@@ -50,16 +45,15 @@
float sleep_in_milliseconds = 0.0f;
// Only consume buffers when actually playing.
- if (playback_rate_ > 0.0f) {
+ if (GetPlaybackRate() > 0.0f) {
size_t bytes = FillBuffer(buffer_.get(),
buffer_size_,
- playback_rate_,
base::TimeDelta());
// Calculate our sleep duration, taking playback rate into consideration.
sleep_in_milliseconds =
floor(bytes / static_cast<float>(bytes_per_millisecond_));
- sleep_in_milliseconds /= playback_rate_;
+ sleep_in_milliseconds /= GetPlaybackRate();
} else {
// If paused, sleep for 10 milliseconds before polling again.
sleep_in_milliseconds = 10.0f;
« no previous file with comments | « media/filters/null_audio_renderer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698