| Index: media/audio/audio_device_thread.h
|
| ===================================================================
|
| --- media/audio/audio_device_thread.h (revision 186213)
|
| +++ media/audio/audio_device_thread.h (working copy)
|
| @@ -8,6 +8,7 @@
|
| #include "base/basictypes.h"
|
| #include "base/memory/ref_counted.h"
|
| #include "base/memory/scoped_ptr.h"
|
| +#include "base/memory/scoped_vector.h"
|
| #include "base/shared_memory.h"
|
| #include "base/sync_socket.h"
|
| #include "base/synchronization/lock.h"
|
| @@ -36,8 +37,10 @@
|
| // thread owned by AudioDeviceThread.
|
| class Callback {
|
| public:
|
| + typedef std::vector<base::SharedMemoryHandle> SharedMemoryHandleVector;
|
| +
|
| Callback(const AudioParameters& audio_parameters,
|
| - base::SharedMemoryHandle memory,
|
| + SharedMemoryHandleVector& memory,
|
| int memory_length);
|
| virtual ~Callback();
|
|
|
| @@ -49,7 +52,8 @@
|
| virtual void MapSharedMemory() = 0;
|
|
|
| // Called whenever we receive notifications about pending data.
|
| - virtual void Process(int pending_data) = 0;
|
| + // The |index| states which shared memory buffer is used.
|
| + virtual void Process(int pending_data, int index) = 0;
|
|
|
| protected:
|
| // Protected so that derived classes can access directly.
|
| @@ -59,14 +63,14 @@
|
| const int samples_per_ms_;
|
| const int bytes_per_ms_;
|
|
|
| - base::SharedMemory shared_memory_;
|
| + ScopedVector<base::SharedMemory> shared_memory_;
|
| const int memory_length_;
|
|
|
| private:
|
| DISALLOW_COPY_AND_ASSIGN(Callback);
|
| };
|
|
|
| - AudioDeviceThread();
|
| + AudioDeviceThread(bool need_read_index);
|
| ~AudioDeviceThread();
|
|
|
| // Starts the audio thread. The thread must not already be running.
|
| @@ -98,6 +102,9 @@
|
| // reliable initialization.
|
| class Thread;
|
|
|
| + // Flag indicating whether need to read index from sync socket.
|
| + bool need_read_index_;
|
| +
|
| base::Lock thread_lock_;
|
| scoped_refptr<AudioDeviceThread::Thread> thread_;
|
|
|
|
|