Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(281)

Unified Diff: ppapi/shared_impl/media_stream_frame_buffer.cc

Issue 140783004: [PPAPI] Pepper MediaStream API audio track implementation and example. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Update Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ppapi/shared_impl/media_stream_frame_buffer.cc
diff --git a/ppapi/shared_impl/media_stream_frame_buffer.cc b/ppapi/shared_impl/media_stream_frame_buffer.cc
index 624883039ecb881504d6b9aa33b0e6adbe6538cb..41586aa445019bdca422b7bd75b8e4b1fe7e1495 100644
--- a/ppapi/shared_impl/media_stream_frame_buffer.cc
+++ b/ppapi/shared_impl/media_stream_frame_buffer.cc
@@ -29,6 +29,7 @@ bool MediaStreamFrameBuffer::SetFrames(
int32_t frame_size,
scoped_ptr<base::SharedMemory> shm,
bool enqueue_all_frames) {
+ base::AutoLock lock(mutex_);
DCHECK(shm);
DCHECK(!shm_);
DCHECK_GT(number_of_frames, 0);
@@ -54,6 +55,7 @@ bool MediaStreamFrameBuffer::SetFrames(
}
int32_t MediaStreamFrameBuffer::DequeueFrame() {
+ base::AutoLock lock(mutex_);
if (frame_queue_.empty())
return PP_ERROR_FAILED;
int32_t frame = frame_queue_.front();
@@ -64,12 +66,16 @@ int32_t MediaStreamFrameBuffer::DequeueFrame() {
void MediaStreamFrameBuffer::EnqueueFrame(int32_t index) {
DCHECK_GE(index, 0);
DCHECK_LT(index, number_of_frames_);
- frame_queue_.push_back(index);
+ {
+ base::AutoLock lock(mutex_);
+ frame_queue_.push_back(index);
+ }
delegate_->OnNewFrameEnqueued();
}
MediaStreamFrame* MediaStreamFrameBuffer::GetFramePointer(
int32_t index) {
+ base::AutoLock lock(mutex_);
DCHECK_GE(index, 0);
DCHECK_LT(index, number_of_frames_);
return frames_[index];

Powered by Google App Engine
This is Rietveld 408576698