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..f1b78492baf2f9cadaecb6a243c33cf5460229b0 100644 |
--- a/webrtc/common_video/include/video_frame_buffer.h |
+++ b/webrtc/common_video/include/video_frame_buffer.h |
@@ -33,7 +33,13 @@ 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. |
+ virtual bool IsMutable() = 0; |
+ |
+ // 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 +82,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 +117,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 +139,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; |