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_; |