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

Side by Side Diff: ppapi/shared_impl/media_stream_track_base_shared.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
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_TRACK_BASE_SHARED_H_
6 #define PPAPI_SHARED_IMPL_MEDIA_STREAM_TRACK_BASE_SHARED_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 MediaStreamTrackBaseShared {
20 protected:
21 MediaStreamTrackBaseShared();
22
23 virtual ~MediaStreamTrackBaseShared();
24
25 int32_t number_of_frames() const { return number_of_frames_; }
26
27 int32_t frame_size() const { return frame_size_; }
28
29 // Initializes shared memory for frames transmission.
30 bool SetFrames(int32_t number_of_frames,
31 int32_t frame_size,
32 scoped_ptr<base::SharedMemory> shm);
33
34 // Dequeues a frame from |frame_queue_|.
35 int32_t DequeueFrame();
36
37 // Puts a frame into |frame_queue_|.
38 void EnqueueFrame(int32_t index);
39
40 // Gets a frame address for the given index.
41 MediaStreamFrame* GetFramePointer(int32_t index);
42
43 // Subclass should implement this method to get notification when a new frame
44 // is enqueued.
45 virtual void OnNewFrameEnqueued();
46
47 private:
48 // A queue of incoming frame indexes.
49 // For the input side, they are empty frames which will be filled with data
50 // and sent to the output side.
51 // For the output side, they are received frames waiting for consuming.
52 std::deque<int32_t> frame_queue_;
53
54 // A vector of frame pointers. It is used for index to pointer converting.
55 std::vector<MediaStreamFrame*> frames_;
56
57 // The frame size in bytes.
58 int32_t frame_size_;
59
60 // The number of frames in the shared memory.
61 int32_t number_of_frames_;
62
63 // A memory block shared between renderer and plugin processes.
64 scoped_ptr<base::SharedMemory> shm_;
65
66 DISALLOW_COPY_AND_ASSIGN(MediaStreamTrackBaseShared);
67 };
68
69 } // namespace ppapi
70
71 #endif // PPAPI_SHAERD_IMPL_MEDIA_STREAM_TRACK_BASE_SHARED_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698