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

Unified Diff: media/filters/audio_renderer_algorithm_base.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/audio_renderer_algorithm_base.h ('k') | media/filters/audio_renderer_base.h » ('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
===================================================================
--- media/filters/audio_renderer_algorithm_base.cc (revision 22189)
+++ media/filters/audio_renderer_algorithm_base.cc (working copy)
@@ -11,7 +11,7 @@
// The size in bytes we try to maintain for the |queue_|. Previous usage
// maintained a deque of 16 Buffers, each of size 4Kb. This worked well, so we
// maintain this number of bytes (16 * 4096).
-const size_t kDefaultMaxQueueSizeInBytes = 65536;
+const size_t kDefaultMinQueueSizeInBytes = 65536;
AudioRendererAlgorithmBase::AudioRendererAlgorithmBase()
: channels_(0),
@@ -43,9 +43,6 @@
request_read_callback_.reset(callback);
set_playback_rate(initial_playback_rate);
-
- // Do the initial read.
- request_read_callback_->Run();
}
void AudioRendererAlgorithmBase::FlushBuffers() {
@@ -55,7 +52,7 @@
}
base::TimeDelta AudioRendererAlgorithmBase::GetTime() {
- return queue_.GetTime(1.0 / (channels() * sample_rate() * sample_bytes()));
+ return queue_.GetTime();
}
void AudioRendererAlgorithmBase::EnqueueBuffer(Buffer* buffer_in) {
@@ -64,7 +61,7 @@
queue_.Enqueue(buffer_in);
// If we still don't have enough data, request more.
- if (queue_.SizeInBytes() < kDefaultMaxQueueSizeInBytes)
+ if (!IsQueueFull())
request_read_callback_->Run();
}
@@ -77,21 +74,25 @@
playback_rate_ = new_rate;
}
+bool AudioRendererAlgorithmBase::IsQueueEmpty() {
+ return queue_.IsEmpty();
+}
+
+bool AudioRendererAlgorithmBase::IsQueueFull() {
+ return (queue_.SizeInBytes() >= kDefaultMinQueueSizeInBytes);
+}
+
void AudioRendererAlgorithmBase::AdvanceInputPosition(size_t bytes) {
queue_.Consume(bytes);
- if (queue_.SizeInBytes() < kDefaultMaxQueueSizeInBytes)
- request_read_callback_->Run();
+ if (!IsQueueFull())
+ request_read_callback_->Run();
}
size_t AudioRendererAlgorithmBase::CopyFromInput(uint8* dest, size_t bytes) {
return queue_.Copy(dest, bytes);
}
-bool AudioRendererAlgorithmBase::IsQueueEmpty() {
- return queue_.IsEmpty();
-}
-
size_t AudioRendererAlgorithmBase::QueueSize() {
return queue_.SizeInBytes();
}
« no previous file with comments | « media/filters/audio_renderer_algorithm_base.h ('k') | media/filters/audio_renderer_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698