Index: webrtc/common_video/i420_buffer_pool.cc |
diff --git a/webrtc/common_video/i420_buffer_pool.cc b/webrtc/common_video/i420_buffer_pool.cc |
index 82a10797b353d3b9978411f1ce9e1c7edf878748..d00ab781aa12634ef3745f82c4a8fae178d0ed76 100644 |
--- a/webrtc/common_video/i420_buffer_pool.cc |
+++ b/webrtc/common_video/i420_buffer_pool.cc |
@@ -29,10 +29,11 @@ class PooledI420Buffer : public webrtc::VideoFrameBuffer { |
const uint8_t* data(webrtc::PlaneType type) const override { |
return buffer_->data(type); |
} |
+ bool IsMutable() { return HasOneRef(); } |
uint8_t* MutableData(webrtc::PlaneType type) override { |
// Make the HasOneRef() check here instead of in |buffer_|, because the pool |
// also has a reference to |buffer_|. |
- RTC_DCHECK(HasOneRef()); |
+ RTC_DCHECK(IsMutable()); |
return const_cast<uint8_t*>(buffer_->data(type)); |
} |
int stride(webrtc::PlaneType type) const override { |
@@ -80,7 +81,7 @@ rtc::scoped_refptr<VideoFrameBuffer> I420BufferPool::CreateBuffer(int width, |
// CreateBuffer that has not been released yet. If the ref count is 1 |
// (HasOneRef), then the list we are looping over holds the only reference |
// and it's safe to reuse. |
- if (buffer->HasOneRef()) |
+ if (buffer->IsMutable()) |
return new rtc::RefCountedObject<PooledI420Buffer>(buffer); |
} |
// Allocate new buffer. |