Index: media/base/audio_fifo.cc |
diff --git a/media/base/audio_fifo.cc b/media/base/audio_fifo.cc |
index bdc7ddf78d0312b962c3fbc59ab13fcd25f8802a..d4479f50e55a45cc61bc1c832dfe886b43ba7092 100644 |
--- a/media/base/audio_fifo.cc |
+++ b/media/base/audio_fifo.cc |
@@ -8,17 +8,19 @@ |
namespace media { |
-// Given current position in the FIFO, the maximum number of elements in the |
-// FIFO and the size of the input; this method provides two output results: |
-// |size| and |wrap_size|. These two results can then be utilized for memcopy |
-// operations to and from the FIFO. |
-// Under "normal" circumstances, |size| will be equal to |in_size| and |
-// |wrap_size| will be zero. This case corresponding to the non-wrapping case |
-// where we have not yet reached the "edge" of the FIFO. If |pos| + |in_size| |
-// exceeds the total size of the FIFO, we must wrap around and start reusing |
-// a part the allocated memory. The size of this part is given by |wrap_size|. |
-static void GetSizes( |
- int pos, int max_size, int in_size, int* size, int* wrap_size) { |
+AudioFifo::AudioFifo(int channels, int frames) |
+ : audio_bus_(AudioBus::Create(channels, frames)), |
+ max_frames_(frames), |
+ frames_pushed_(0), |
+ frames_consumed_(0), |
+ read_pos_(0), |
+ write_pos_(0) {} |
+ |
+AudioFifo::~AudioFifo() {} |
+ |
+// static. |
+void AudioFifo::GetSizes(int pos, int max_size, int in_size, |
+ int* size, int* wrap_size) { |
if (pos + in_size > max_size) { |
// Wrapping is required => derive size of each segment. |
*size = max_size - pos; |
@@ -30,23 +32,11 @@ static void GetSizes( |
} |
} |
-// Updates the read/write position with |step| modulo the maximum number of |
-// elements in the FIFO to ensure that the position counters wraps around at |
-// the endpoint. |
-static int UpdatePos(int pos, int step, int max_size) { |
+// static. |
+int AudioFifo::UpdatePos(int pos, int step, int max_size) { |
return ((pos + step) % max_size); |
} |
-AudioFifo::AudioFifo(int channels, int frames) |
- : audio_bus_(AudioBus::Create(channels, frames)), |
- max_frames_(frames), |
- frames_pushed_(0), |
- frames_consumed_(0), |
- read_pos_(0), |
- write_pos_(0) {} |
- |
-AudioFifo::~AudioFifo() {} |
- |
int AudioFifo::frames() const { |
int delta = frames_pushed_ - frames_consumed_; |
return delta; |