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 */ |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 void ClearPool(); | 81 void ClearPool(); |
82 | 82 |
83 // InitializeVpxUsePool configures libvpx to call this function when it needs | 83 // InitializeVpxUsePool configures libvpx to call this function when it needs |
84 // a new frame buffer. Parameters: | 84 // a new frame buffer. Parameters: |
85 // |user_priv| Private data passed to libvpx, InitializeVpxUsePool sets it up | 85 // |user_priv| Private data passed to libvpx, InitializeVpxUsePool sets it up |
86 // to be a pointer to the pool. | 86 // to be a pointer to the pool. |
87 // |min_size| Minimum size needed by libvpx (to decompress a frame). | 87 // |min_size| Minimum size needed by libvpx (to decompress a frame). |
88 // |fb| Pointer to the libvpx frame buffer object, this is updated to | 88 // |fb| Pointer to the libvpx frame buffer object, this is updated to |
89 // use the pool's buffer. | 89 // use the pool's buffer. |
90 // Returns 0 on success. Returns < 0 on failure. | 90 // Returns 0 on success. Returns < 0 on failure. |
91 static int32 VpxGetFrameBuffer(void* user_priv, | 91 static int32_t VpxGetFrameBuffer(void* user_priv, |
92 size_t min_size, | 92 size_t min_size, |
93 vpx_codec_frame_buffer* fb); | 93 vpx_codec_frame_buffer* fb); |
94 | 94 |
95 // InitializeVpxUsePool configures libvpx to call this function when it has | 95 // InitializeVpxUsePool configures libvpx to call this function when it has |
96 // finished using one of the pool's frame buffer. Parameters: | 96 // finished using one of the pool's frame buffer. Parameters: |
97 // |user_priv| Private data passed to libvpx, InitializeVpxUsePool sets it up | 97 // |user_priv| Private data passed to libvpx, InitializeVpxUsePool sets it up |
98 // to be a pointer to the pool. | 98 // to be a pointer to the pool. |
99 // |fb| Pointer to the libvpx frame buffer object, its |priv| will be | 99 // |fb| Pointer to the libvpx frame buffer object, its |priv| will be |
100 // a pointer to one of the pool's Vp9FrameBuffer. | 100 // a pointer to one of the pool's Vp9FrameBuffer. |
101 static int32 VpxReleaseFrameBuffer(void* user_priv, | 101 static int32_t VpxReleaseFrameBuffer(void* user_priv, |
102 vpx_codec_frame_buffer* fb); | 102 vpx_codec_frame_buffer* fb); |
103 | 103 |
104 private: | 104 private: |
105 // Protects |allocated_buffers_|. | 105 // Protects |allocated_buffers_|. |
106 mutable rtc::CriticalSection buffers_lock_; | 106 mutable rtc::CriticalSection buffers_lock_; |
107 // All buffers, in use or ready to be recycled. | 107 // All buffers, in use or ready to be recycled. |
108 std::vector<rtc::scoped_refptr<Vp9FrameBuffer>> allocated_buffers_ | 108 std::vector<rtc::scoped_refptr<Vp9FrameBuffer>> allocated_buffers_ |
109 GUARDED_BY(buffers_lock_); | 109 GUARDED_BY(buffers_lock_); |
110 // If more buffers than this are allocated we print warnings, and crash if | 110 // If more buffers than this are allocated we print warnings, and crash if |
111 // in debug mode. | 111 // in debug mode. |
112 static const size_t max_num_buffers_ = 10; | 112 static const size_t max_num_buffers_ = 10; |
113 }; | 113 }; |
114 | 114 |
115 } // namespace webrtc | 115 } // namespace webrtc |
116 | 116 |
117 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP9_FRAME_BUFFER_POOL_H_ | 117 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP9_FRAME_BUFFER_POOL_H_ |
OLD | NEW |