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

Side by Side Diff: ppapi/shared_impl/media_stream_frame_buffer.h

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, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef PPAPI_SHARED_IMPL_MEDIA_STREAM_FRAME_BUFFER_H_ 5 #ifndef PPAPI_SHARED_IMPL_MEDIA_STREAM_FRAME_BUFFER_H_
6 #define PPAPI_SHARED_IMPL_MEDIA_STREAM_FRAME_BUFFER_H_ 6 #define PPAPI_SHARED_IMPL_MEDIA_STREAM_FRAME_BUFFER_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 20 matching lines...) Expand all
31 // 6. When the frame from the step 5 is consumed, the reader sends the frame 31 // 6. When the frame from the step 5 is consumed, the reader sends the frame
32 // index back to writer via an IPC message. 32 // index back to writer via an IPC message.
33 // 7. The writer receives the frame index and puts it back to the writer's free 33 // 7. The writer receives the frame index and puts it back to the writer's free
34 // frame queue by calling the writer's |frame_buffer_.Enqueue()|. 34 // frame queue by calling the writer's |frame_buffer_.Enqueue()|.
35 // 8. Go back to step 1. 35 // 8. Go back to step 1.
36 class PPAPI_SHARED_EXPORT MediaStreamFrameBuffer { 36 class PPAPI_SHARED_EXPORT MediaStreamFrameBuffer {
37 public: 37 public:
38 class PPAPI_SHARED_EXPORT Delegate { 38 class PPAPI_SHARED_EXPORT Delegate {
39 public: 39 public:
40 virtual ~Delegate(); 40 virtual ~Delegate();
41 // It is called when a new frame is enqueued. 41 // It is called before a new frame being enqueued. Return true if the frame
42 virtual void OnNewFrameEnqueued(); 42 // is consumed by |Delegate|, and then the frame will not be added into the
43 // |frame_queue_|.
44 virtual bool OnNewFramePreEnqueued(int32_t index);
yzshen1 2014/01/29 21:28:06 BeforeNewFrameEnqueued() may be more clearer. Tha
Peng 2014/01/31 18:54:43 I though the performance is slightly better by avo
43 }; 45 };
44 46
45 // MediaStreamFrameBuffer doesn't own |delegate|, the caller should keep 47 // MediaStreamFrameBuffer doesn't own |delegate|, the caller should keep
46 // it alive during the MediaStreamFrameBuffer's lifecycle. 48 // it alive during the MediaStreamFrameBuffer's lifecycle.
47 explicit MediaStreamFrameBuffer(Delegate* delegate); 49 explicit MediaStreamFrameBuffer(Delegate* delegate);
48 50
49 ~MediaStreamFrameBuffer(); 51 ~MediaStreamFrameBuffer();
50 52
51 int32_t number_of_frames() const { return number_of_frames_; } 53 int32_t number_of_frames() const { return number_of_frames_; }
52 54
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 86
85 // A memory block shared between renderer process and plugin process. 87 // A memory block shared between renderer process and plugin process.
86 scoped_ptr<base::SharedMemory> shm_; 88 scoped_ptr<base::SharedMemory> shm_;
87 89
88 DISALLOW_COPY_AND_ASSIGN(MediaStreamFrameBuffer); 90 DISALLOW_COPY_AND_ASSIGN(MediaStreamFrameBuffer);
89 }; 91 };
90 92
91 } // namespace ppapi 93 } // namespace ppapi
92 94
93 #endif // PPAPI_SHAERD_IMPL_MEDIA_STREAM_FRAME_BUFFER_H_ 95 #endif // PPAPI_SHAERD_IMPL_MEDIA_STREAM_FRAME_BUFFER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698