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

Unified Diff: media/base/audio_block_fifo.cc

Issue 396263004: Switch the input code to use AudioBlockFifo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed the comments. Created 6 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/base/audio_block_fifo.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/audio_block_fifo.cc
diff --git a/media/base/audio_block_fifo.cc b/media/base/audio_block_fifo.cc
index b8cecfa164e6890c5c4c1b2f838860d7da64a953..5e8c9b37949babea29b10a464b2a6e3fd9189610 100644
--- a/media/base/audio_block_fifo.cc
+++ b/media/base/audio_block_fifo.cc
@@ -44,7 +44,8 @@ void AudioBlockFifo::Push(const void* source,
std::min(block_frames_ - write_pos_, frames_to_push);
// Deinterleave the content to the FIFO and update the |write_pos_|.
- current_block->FromInterleaved(source_ptr, push_frames, bytes_per_sample);
+ current_block->FromInterleavedPartial(
+ source_ptr, write_pos_, push_frames, bytes_per_sample);
write_pos_ = (write_pos_ + push_frames) % block_frames_;
if (!write_pos_) {
// The current block is completely filled, increment |write_block_| and
@@ -55,6 +56,7 @@ void AudioBlockFifo::Push(const void* source,
source_ptr += push_frames * bytes_per_sample * current_block->channels();
frames_to_push -= push_frames;
+ DCHECK_GE(frames_to_push, 0);
}
}
@@ -73,6 +75,10 @@ void AudioBlockFifo::Clear() {
available_blocks_ = 0;
}
+int AudioBlockFifo::GetAvailableFrames() const {
+ return available_blocks_ * block_frames_ + write_pos_;
+}
+
int AudioBlockFifo::GetUnfilledFrames() const {
const int unfilled_frames =
(audio_blocks_.size() - available_blocks_) * block_frames_ - write_pos_;
« no previous file with comments | « media/base/audio_block_fifo.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698