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

Unified Diff: webrtc/common_video/include/video_frame_buffer.h

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/i420_buffer_pool_unittest.cc ('k') | webrtc/common_video/video_frame.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/common_video/include/video_frame_buffer.h
diff --git a/webrtc/common_video/include/video_frame_buffer.h b/webrtc/common_video/include/video_frame_buffer.h
index 9cf57a43591b1da66f82ed9d59ffde5794fdc212..e78a1d696884354ec4021f3c58fc9da9949eebf2 100644
--- a/webrtc/common_video/include/video_frame_buffer.h
+++ b/webrtc/common_video/include/video_frame_buffer.h
@@ -33,7 +33,16 @@ enum PlaneType {
// not contain any frame metadata such as rotation, timestamp, pixel_width, etc.
class VideoFrameBuffer : public rtc::RefCountInterface {
public:
- // Returns true if this buffer has a single exclusive owner.
+ // Returns true if the caller is exclusive owner, and allowed to
+ // call MutableData.
+
+ // TODO(nisse): Delete default implementation when subclasses in
+ // Chrome are updated.
+ virtual bool IsMutable() { return false; }
+
+ // Underlying refcount access, used to implement IsMutable.
+ // TODO(nisse): Demote to protected, as soon as Chrome is changed to
+ // use IsMutable.
virtual bool HasOneRef() const = 0;
// The resolution of the frame in pixels. For formats where some planes are
@@ -76,6 +85,7 @@ class I420Buffer : public VideoFrameBuffer {
const uint8_t* data(PlaneType type) const override;
// Non-const data access is only allowed if HasOneRef() is true to protect
// against unexpected overwrites.
+ bool IsMutable() override;
uint8_t* MutableData(PlaneType type) override;
int stride(PlaneType type) const override;
void* native_handle() const override;
@@ -110,6 +120,7 @@ class NativeHandleBuffer : public VideoFrameBuffer {
const uint8_t* data(PlaneType type) const override;
int stride(PlaneType type) const override;
void* native_handle() const override;
+ bool IsMutable() override;
protected:
void* native_handle_;
@@ -131,6 +142,8 @@ class WrappedI420Buffer : public webrtc::VideoFrameBuffer {
int width() const override;
int height() const override;
+ bool IsMutable() override;
+
const uint8_t* data(PlaneType type) const override;
int stride(PlaneType type) const override;
« no previous file with comments | « webrtc/common_video/i420_buffer_pool_unittest.cc ('k') | webrtc/common_video/video_frame.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698