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

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

Issue 101463008: [NOT FOR REVIEW][PPAPI] Implement MediaStreamVideoTrack pepper API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@lkgr
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 unified diff | Download patch
« no previous file with comments | « ppapi/shared_impl/media_stream_frame.h ('k') | ppapi/shared_impl/media_stream_frame_buffer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef PPAPI_SHARED_IMPL_MEDIA_STREAM_FRAME_BUFFER_H_
6 #define PPAPI_SHARED_IMPL_MEDIA_STREAM_FRAME_BUFFER_H_
7
8 #include <deque>
9 #include <vector>
10
11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/memory/shared_memory.h"
14 #include "ppapi/shared_impl/media_stream_frame.h"
15 #include "ppapi/shared_impl/ppapi_shared_export.h"
16
17 namespace ppapi {
18
19 class PPAPI_SHARED_EXPORT MediaStreamFrameBuffer {
20 public:
21 class Delegate {
22 public:
23 // It is called when a new frame is enqueued.
24 virtual void OnNewFrameEnqueued();
25 };
26
27 explicit MediaStreamFrameBuffer(Delegate* delegate);
28
29 virtual ~MediaStreamFrameBuffer();
30
31 int32_t number_of_frames() const { return number_of_frames_; }
32
33 int32_t frame_size() const { return frame_size_; }
34
35 // Initializes shared memory for frames transmission.
36 bool SetFrames(int32_t number_of_frames,
37 int32_t frame_size,
38 scoped_ptr<base::SharedMemory> shm,
39 bool enqueue_all_frames);
40
41 // Dequeues a frame from |frame_queue_|.
42 int32_t DequeueFrame();
43
44 // Puts a frame into |frame_queue_|.
45 void EnqueueFrame(int32_t index);
46
47 // Gets a frame address for the given index.
48 MediaStreamFrame* GetFramePointer(int32_t index);
49
50 virtual void OnNewFrameEnqueued();
51
52 private:
53 Delegate* delegate_;
54 // A queue of incoming frame indexes.
55 // For the input side, they are empty frames which will be filled with data
56 // and sent to the output side.
57 // For the output side, they are received frames waiting for consuming.
58 std::deque<int32_t> frame_queue_;
59
60 // A vector of frame pointers. It is used for index to pointer converting.
61 std::vector<MediaStreamFrame*> frames_;
62
63 // The frame size in bytes.
64 int32_t frame_size_;
65
66 // The number of frames in the shared memory.
67 int32_t number_of_frames_;
68
69 // A memory block shared between renderer and plugin processes.
70 scoped_ptr<base::SharedMemory> shm_;
71
72 DISALLOW_COPY_AND_ASSIGN(MediaStreamFrameBuffer);
73 };
74
75 } // namespace ppapi
76
77 #endif // PPAPI_SHAERD_IMPL_MEDIA_STREAM_FRAME_BUFFER_H_
OLDNEW
« no previous file with comments | « ppapi/shared_impl/media_stream_frame.h ('k') | ppapi/shared_impl/media_stream_frame_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698