Index: webrtc/common_video/include/i420_buffer_pool.h |
diff --git a/webrtc/common_video/include/i420_buffer_pool.h b/webrtc/common_video/include/i420_buffer_pool.h |
index 5c9ab06a097f1afbd0013cc5c6439d7b62890552..fcf13e172da77fc7e369ca7ad250954b76b47cfd 100644 |
--- a/webrtc/common_video/include/i420_buffer_pool.h |
+++ b/webrtc/common_video/include/i420_buffer_pool.h |
@@ -27,17 +27,31 @@ class I420BufferPool { |
public: |
I420BufferPool() : I420BufferPool(false) {} |
explicit I420BufferPool(bool zero_initialize); |
+ ~I420BufferPool(); |
// Returns a buffer from the pool, or creates a new buffer if no suitable |
// buffer exists in the pool. |
- rtc::scoped_refptr<VideoFrameBuffer> CreateBuffer(int width, int height); |
+ rtc::scoped_refptr<I420Buffer> CreateBuffer(int width, int height); |
// Clears buffers_ and detaches the thread checker so that it can be reused |
// later from another thread. |
void Release(); |
private: |
+ class PooledI420Buffer : public webrtc::I420Buffer { |
+ public: |
+ PooledI420Buffer(int width, int height); |
+ bool IsMutable() override; |
+ bool IsFree(); |
+ void UnManage(); |
+ |
+ private: |
+ virtual int GetRefCount() const = 0; |
+ int IsManaged() const; |
+ volatile int managed_; |
+ }; |
+ |
rtc::ThreadChecker thread_checker_; |
- std::list<rtc::scoped_refptr<I420Buffer>> buffers_; |
+ std::list<rtc::scoped_refptr<PooledI420Buffer>> buffers_; |
// If true, newly allocated buffers are zero-initialized. Note that recycled |
// buffers are not zero'd before reuse. This is required of buffers used by |
// FFmpeg according to http://crbug.com/390941, which only requires it for the |