| Index: media/base/audio_fifo.h
|
| ===================================================================
|
| --- media/base/audio_fifo.h (revision 157152)
|
| +++ media/base/audio_fifo.h (working copy)
|
| @@ -5,6 +5,7 @@
|
| #ifndef MEDIA_BASE_AUDIO_FIFO_H_
|
| #define MEDIA_BASE_AUDIO_FIFO_H_
|
|
|
| +#include "base/atomicops.h"
|
| #include "media/base/audio_bus.h"
|
| #include "media/base/media_export.h"
|
|
|
| @@ -14,6 +15,8 @@
|
| // The maximum number of audio frames in the FIFO is set at construction and
|
| // can not be extended dynamically. The allocated memory is utilized as a
|
| // ring buffer.
|
| +// This class is thread-safe in the limited sense that one thread may call
|
| +// Push(), while a second thread calls Consume().
|
| class MEDIA_EXPORT AudioFifo {
|
| public:
|
| // Creates a new AudioFifo and allocates |channels| of length |frames|.
|
| @@ -35,11 +38,11 @@
|
| void Clear();
|
|
|
| // Number of actual audio frames in the FIFO.
|
| - int frames() const { return frames_; }
|
| + int frames() const;
|
|
|
| - private:
|
| int max_frames() const { return max_frames_; }
|
|
|
| + private:
|
| // The actual FIFO is an audio bus implemented as a ring buffer.
|
| scoped_ptr<AudioBus> audio_bus_;
|
|
|
| @@ -48,7 +51,8 @@
|
| const int max_frames_;
|
|
|
| // Number of actual elements in the FIFO.
|
| - int frames_;
|
| + volatile base::subtle::Atomic32 frames_pushed_;
|
| + volatile base::subtle::Atomic32 frames_consumed_;
|
|
|
| // Current read position.
|
| int read_pos_;
|
|
|