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

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

Issue 859313002: Pepper: Define PPB_VideoEncoder API + Implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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/proxy/video_encoder_resource.cc ('k') | ppapi/shared_impl/media_stream_buffer_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_BUFFER_MANAGER_H_ 5 #ifndef PPAPI_SHARED_IMPL_MEDIA_STREAM_BUFFER_MANAGER_H_
6 #define PPAPI_SHARED_IMPL_MEDIA_STREAM_BUFFER_MANAGER_H_ 6 #define PPAPI_SHARED_IMPL_MEDIA_STREAM_BUFFER_MANAGER_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 // MediaStreamBufferManager doesn't own |delegate|, the caller should keep 46 // MediaStreamBufferManager doesn't own |delegate|, the caller should keep
47 // it alive during the MediaStreamBufferManager's lifecycle. 47 // it alive during the MediaStreamBufferManager's lifecycle.
48 explicit MediaStreamBufferManager(Delegate* delegate); 48 explicit MediaStreamBufferManager(Delegate* delegate);
49 49
50 ~MediaStreamBufferManager(); 50 ~MediaStreamBufferManager();
51 51
52 int32_t number_of_buffers() const { return number_of_buffers_; } 52 int32_t number_of_buffers() const { return number_of_buffers_; }
53 53
54 int32_t buffer_size() const { return buffer_size_; } 54 int32_t buffer_size() const { return buffer_size_; }
55 55
56 base::SharedMemory* shm() { return shm_.get(); }
57
56 // Initializes shared memory for buffers transmission. 58 // Initializes shared memory for buffers transmission.
57 bool SetBuffers(int32_t number_of_buffers, 59 bool SetBuffers(int32_t number_of_buffers,
58 int32_t buffer_size, 60 int32_t buffer_size,
59 scoped_ptr<base::SharedMemory> shm, 61 scoped_ptr<base::SharedMemory> shm,
60 bool enqueue_all_buffers); 62 bool enqueue_all_buffers);
61 63
64 // Number of buffers available.
65 int32 BuffersAvailable();
66
62 // Dequeues a buffer from |buffer_queue_|. 67 // Dequeues a buffer from |buffer_queue_|.
63 int32_t DequeueBuffer(); 68 int32_t DequeueBuffer();
64 69
65 // Dequeues all the buffers from |buffer_queue_|. 70 // Dequeues all the buffers from |buffer_queue_|.
66 std::vector<int32_t> DequeueBuffers(); 71 std::vector<int32_t> DequeueBuffers();
67 72
68 // Puts a buffer into |buffer_queue_|. 73 // Puts a buffer into |buffer_queue_|.
69 void EnqueueBuffer(int32_t index); 74 void EnqueueBuffer(int32_t index);
70 75
71 // Gets the buffer address for the given buffer index. 76 // Gets the buffer address for the given buffer index.
72 MediaStreamBuffer* GetBufferPointer(int32_t index); 77 MediaStreamBuffer* GetBufferPointer(int32_t index);
73 78
79 // Checks whether |buffer| is contains in the buffer manager.
80 bool ContainsBuffer(MediaStreamBuffer* buffer);
81
74 private: 82 private:
75 Delegate* delegate_; 83 Delegate* delegate_;
76 84
77 // A queue of buffer indices. 85 // A queue of buffer indices.
78 std::deque<int32_t> buffer_queue_; 86 std::deque<int32_t> buffer_queue_;
79 87
80 // A vector of buffer pointers. It is used for index to pointer converting. 88 // A vector of buffer pointers. It is used for index to pointer converting.
81 std::vector<MediaStreamBuffer*> buffers_; 89 std::vector<MediaStreamBuffer*> buffers_;
82 90
83 // The buffer size in bytes. 91 // The buffer size in bytes.
84 int32_t buffer_size_; 92 int32_t buffer_size_;
85 93
86 // The number of buffers in the shared memory. 94 // The number of buffers in the shared memory.
87 int32_t number_of_buffers_; 95 int32_t number_of_buffers_;
88 96
89 // A memory block shared between renderer process and plugin process. 97 // A memory block shared between renderer process and plugin process.
90 scoped_ptr<base::SharedMemory> shm_; 98 scoped_ptr<base::SharedMemory> shm_;
91 99
92 DISALLOW_COPY_AND_ASSIGN(MediaStreamBufferManager); 100 DISALLOW_COPY_AND_ASSIGN(MediaStreamBufferManager);
93 }; 101 };
94 102
95 } // namespace ppapi 103 } // namespace ppapi
96 104
97 #endif // PPAPI_SHAERD_IMPL_MEDIA_STREAM_BUFFER_MANAGER_H_ 105 #endif // PPAPI_SHAERD_IMPL_MEDIA_STREAM_BUFFER_MANAGER_H_
OLDNEW
« no previous file with comments | « ppapi/proxy/video_encoder_resource.cc ('k') | ppapi/shared_impl/media_stream_buffer_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698