OLD | NEW |
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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <deque> | 10 #include <deque> |
| 11 #include <memory> |
11 #include <vector> | 12 #include <vector> |
12 | 13 |
13 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
14 #include "base/macros.h" | 15 #include "base/macros.h" |
15 #include "base/memory/scoped_ptr.h" | |
16 #include "base/memory/shared_memory.h" | 16 #include "base/memory/shared_memory.h" |
17 #include "ppapi/shared_impl/ppapi_shared_export.h" | 17 #include "ppapi/shared_impl/ppapi_shared_export.h" |
18 | 18 |
19 namespace ppapi { | 19 namespace ppapi { |
20 | 20 |
21 union MediaStreamBuffer; | 21 union MediaStreamBuffer; |
22 | 22 |
23 // This class is used by both read side and write side of a MediaStreamTrack to | 23 // This class is used by both read side and write side of a MediaStreamTrack to |
24 // maintain a queue of buffers for reading or writing. | 24 // maintain a queue of buffers for reading or writing. |
25 // | 25 // |
(...skipping 28 matching lines...) Expand all Loading... |
54 | 54 |
55 int32_t number_of_buffers() const { return number_of_buffers_; } | 55 int32_t number_of_buffers() const { return number_of_buffers_; } |
56 | 56 |
57 int32_t buffer_size() const { return buffer_size_; } | 57 int32_t buffer_size() const { return buffer_size_; } |
58 | 58 |
59 base::SharedMemory* shm() { return shm_.get(); } | 59 base::SharedMemory* shm() { return shm_.get(); } |
60 | 60 |
61 // Initializes shared memory for buffers transmission. | 61 // Initializes shared memory for buffers transmission. |
62 bool SetBuffers(int32_t number_of_buffers, | 62 bool SetBuffers(int32_t number_of_buffers, |
63 int32_t buffer_size, | 63 int32_t buffer_size, |
64 scoped_ptr<base::SharedMemory> shm, | 64 std::unique_ptr<base::SharedMemory> shm, |
65 bool enqueue_all_buffers); | 65 bool enqueue_all_buffers); |
66 | 66 |
67 // Dequeues a buffer from |buffer_queue_|. | 67 // Dequeues a buffer from |buffer_queue_|. |
68 int32_t DequeueBuffer(); | 68 int32_t DequeueBuffer(); |
69 | 69 |
70 // Dequeues all the buffers from |buffer_queue_|. | 70 // Dequeues all the buffers from |buffer_queue_|. |
71 std::vector<int32_t> DequeueBuffers(); | 71 std::vector<int32_t> DequeueBuffers(); |
72 | 72 |
73 // Puts a buffer into |buffer_queue_|. | 73 // Puts a buffer into |buffer_queue_|. |
74 void EnqueueBuffer(int32_t index); | 74 void EnqueueBuffer(int32_t index); |
(...skipping 13 matching lines...) Expand all Loading... |
88 // 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. |
89 std::vector<MediaStreamBuffer*> buffers_; | 89 std::vector<MediaStreamBuffer*> buffers_; |
90 | 90 |
91 // The buffer size in bytes. | 91 // The buffer size in bytes. |
92 int32_t buffer_size_; | 92 int32_t buffer_size_; |
93 | 93 |
94 // The number of buffers in the shared memory. | 94 // The number of buffers in the shared memory. |
95 int32_t number_of_buffers_; | 95 int32_t number_of_buffers_; |
96 | 96 |
97 // A memory block shared between renderer process and plugin process. | 97 // A memory block shared between renderer process and plugin process. |
98 scoped_ptr<base::SharedMemory> shm_; | 98 std::unique_ptr<base::SharedMemory> shm_; |
99 | 99 |
100 DISALLOW_COPY_AND_ASSIGN(MediaStreamBufferManager); | 100 DISALLOW_COPY_AND_ASSIGN(MediaStreamBufferManager); |
101 }; | 101 }; |
102 | 102 |
103 } // namespace ppapi | 103 } // namespace ppapi |
104 | 104 |
105 #endif // PPAPI_SHAERD_IMPL_MEDIA_STREAM_BUFFER_MANAGER_H_ | 105 #endif // PPAPI_SHAERD_IMPL_MEDIA_STREAM_BUFFER_MANAGER_H_ |
OLD | NEW |