Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(615)

Unified Diff: webrtc/common_video/i420_buffer_pool.cc

Issue 1881933004: Introduce an IsMutable method on VideoFrameBuffer. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/common_video/i420_buffer_pool_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « no previous file | webrtc/common_video/i420_buffer_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698