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

Unified Diff: webrtc/common_video/video_frame_buffer.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 | « webrtc/common_video/video_frame.cc ('k') | webrtc/media/engine/webrtcvideoframe.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/common_video/video_frame_buffer.cc
diff --git a/webrtc/common_video/video_frame_buffer.cc b/webrtc/common_video/video_frame_buffer.cc
index 6f49e8aef9d0f1f387ff15cce119aca0699567ac..6ce806e35e5b1a490c301fd9c18374954f9528a2 100644
--- a/webrtc/common_video/video_frame_buffer.cc
+++ b/webrtc/common_video/video_frame_buffer.cc
@@ -89,8 +89,12 @@ const uint8_t* I420Buffer::data(PlaneType type) const {
}
}
+bool I420Buffer::IsMutable() {
+ return HasOneRef();
+}
+
uint8_t* I420Buffer::MutableData(PlaneType type) {
- RTC_DCHECK(HasOneRef());
+ RTC_DCHECK(IsMutable());
return const_cast<uint8_t*>(
static_cast<const VideoFrameBuffer*>(this)->data(type));
}
@@ -144,6 +148,10 @@ NativeHandleBuffer::NativeHandleBuffer(void* native_handle,
RTC_DCHECK_GT(height, 0);
}
+bool NativeHandleBuffer::IsMutable() {
+ return false;
+}
+
int NativeHandleBuffer::width() const {
return width_;
}
@@ -190,6 +198,11 @@ WrappedI420Buffer::~WrappedI420Buffer() {
no_longer_used_cb_();
}
+// Data owned by creator; never mutable.
+bool WrappedI420Buffer::IsMutable() {
+ return false;
+}
+
int WrappedI420Buffer::width() const {
return width_;
}
« no previous file with comments | « webrtc/common_video/video_frame.cc ('k') | webrtc/media/engine/webrtcvideoframe.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698