OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_COMMON_VIDEO_INTERFACE_I420_BUFFER_POOL_H_ | 11 #ifndef WEBRTC_COMMON_VIDEO_INCLUDE_I420_BUFFER_POOL_H_ |
12 #define WEBRTC_COMMON_VIDEO_INTERFACE_I420_BUFFER_POOL_H_ | 12 #define WEBRTC_COMMON_VIDEO_INCLUDE_I420_BUFFER_POOL_H_ |
| 13 |
| 14 #pragma message("WARNING: common_video/include is DEPRECATED; use common_video/i
nclude") |
13 | 15 |
14 #include <list> | 16 #include <list> |
15 | 17 |
16 #include "webrtc/base/thread_checker.h" | 18 #include "webrtc/base/thread_checker.h" |
17 #include "webrtc/common_video/interface/video_frame_buffer.h" | 19 #include "webrtc/common_video/include/video_frame_buffer.h" |
18 | 20 |
19 namespace webrtc { | 21 namespace webrtc { |
20 | 22 |
21 // Simple buffer pool to avoid unnecessary allocations of I420Buffer objects. | 23 // Simple buffer pool to avoid unnecessary allocations of I420Buffer objects. |
22 // The pool manages the memory of the I420Buffer returned from CreateBuffer. | 24 // The pool manages the memory of the I420Buffer returned from CreateBuffer. |
23 // When the I420Buffer is destructed, the memory is returned to the pool for use | 25 // When the I420Buffer is destructed, the memory is returned to the pool for use |
24 // by subsequent calls to CreateBuffer. If the resolution passed to CreateBuffer | 26 // by subsequent calls to CreateBuffer. If the resolution passed to CreateBuffer |
25 // changes, old buffers will be purged from the pool. | 27 // changes, old buffers will be purged from the pool. |
26 class I420BufferPool { | 28 class I420BufferPool { |
27 public: | 29 public: |
28 I420BufferPool(); | 30 I420BufferPool(); |
29 // Returns a buffer from the pool, or creates a new buffer if no suitable | 31 // Returns a buffer from the pool, or creates a new buffer if no suitable |
30 // buffer exists in the pool. | 32 // buffer exists in the pool. |
31 rtc::scoped_refptr<VideoFrameBuffer> CreateBuffer(int width, int height); | 33 rtc::scoped_refptr<VideoFrameBuffer> CreateBuffer(int width, int height); |
32 // Clears buffers_ and detaches the thread checker so that it can be reused | 34 // Clears buffers_ and detaches the thread checker so that it can be reused |
33 // later from another thread. | 35 // later from another thread. |
34 void Release(); | 36 void Release(); |
35 | 37 |
36 private: | 38 private: |
37 rtc::ThreadChecker thread_checker_; | 39 rtc::ThreadChecker thread_checker_; |
38 std::list<rtc::scoped_refptr<I420Buffer>> buffers_; | 40 std::list<rtc::scoped_refptr<I420Buffer>> buffers_; |
39 }; | 41 }; |
40 | 42 |
41 } // namespace webrtc | 43 } // namespace webrtc |
42 | 44 |
43 #endif // WEBRTC_COMMON_VIDEO_INTERFACE_I420_BUFFER_POOL_H_ | 45 #endif // WEBRTC_COMMON_VIDEO_INCLUDE_I420_BUFFER_POOL_H_ |
OLD | NEW |