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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_t 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 rtc::CriticalSection buffers_lock_; | 106 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 RTC_GUARDED_BY(buffers_lock_); |
110 // If more buffers than this are allocated we print warnings and crash if in | 110 // If more buffers than this are allocated we print warnings and crash if in |
111 // debug mode. VP9 is defined to have 8 reference buffers, of which 3 can be | 111 // debug mode. VP9 is defined to have 8 reference buffers, of which 3 can be |
112 // referenced by any frame, see | 112 // referenced by any frame, see |
113 // https://tools.ietf.org/html/draft-grange-vp9-bitstream-00#section-2.2.2. | 113 // https://tools.ietf.org/html/draft-grange-vp9-bitstream-00#section-2.2.2. |
114 // Assuming VP9 holds on to at most 8 buffers, any more buffers than that | 114 // Assuming VP9 holds on to at most 8 buffers, any more buffers than that |
115 // would have to be by application code. Decoded frames should not be | 115 // would have to be by application code. Decoded frames should not be |
116 // referenced for longer than necessary. If we allow ~60 additional buffers | 116 // referenced for longer than necessary. If we allow ~60 additional buffers |
117 // then the application has ~1 second to e.g. render each frame of a 60 fps | 117 // then the application has ~1 second to e.g. render each frame of a 60 fps |
118 // video. | 118 // video. |
119 static const size_t max_num_buffers_ = 68; | 119 static const size_t max_num_buffers_ = 68; |
120 }; | 120 }; |
121 | 121 |
122 } // namespace webrtc | 122 } // namespace webrtc |
123 | 123 |
124 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP9_VP9_FRAME_BUFFER_POOL_H_ | 124 #endif // WEBRTC_MODULES_VIDEO_CODING_CODECS_VP9_VP9_FRAME_BUFFER_POOL_H_ |
OLD | NEW |