Index: ppapi/shared_impl/media_stream_frame_buffer.h |
diff --git a/ppapi/shared_impl/media_stream_frame_buffer.h b/ppapi/shared_impl/media_stream_frame_buffer.h |
index e95084642c03bc20a2ae32b452df4f0a88ca8c4d..ab46b272a55ec0ddc4c1e789c1454d6e4e441dfb 100644 |
--- a/ppapi/shared_impl/media_stream_frame_buffer.h |
+++ b/ppapi/shared_impl/media_stream_frame_buffer.h |
@@ -11,6 +11,7 @@ |
#include "base/compiler_specific.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/memory/shared_memory.h" |
+#include "base/synchronization/lock.h" |
#include "ppapi/shared_impl/media_stream_frame.h" |
#include "ppapi/shared_impl/ppapi_shared_export.h" |
@@ -48,9 +49,15 @@ class PPAPI_SHARED_EXPORT MediaStreamFrameBuffer { |
~MediaStreamFrameBuffer(); |
- int32_t number_of_frames() const { return number_of_frames_; } |
+ int32_t number_of_frames() const { |
+ base::AutoLock lock(mutex_); |
+ return number_of_frames_; |
+ } |
- int32_t frame_size() const { return frame_size_; } |
+ int32_t frame_size() const { |
+ base::AutoLock lock(mutex_); |
+ return frame_size_; |
+ } |
// Initializes shared memory for frames transmission. |
bool SetFrames(int32_t number_of_frames, |
@@ -70,6 +77,9 @@ class PPAPI_SHARED_EXPORT MediaStreamFrameBuffer { |
private: |
Delegate* delegate_; |
+ // A mutex to protect below fields. |
+ mutable base::Lock mutex_; |
dmichael (off chromium)
2014/01/16 22:34:20
Can you explain more about why you've done this? W
Peng
2014/01/17 00:23:49
All audio frames are received from an audio thread
|
+ |
// A queue of frame indexes. |
std::deque<int32_t> frame_queue_; |