Index: webrtc/modules/desktop_capture/desktop_frame.h |
diff --git a/webrtc/modules/desktop_capture/desktop_frame.h b/webrtc/modules/desktop_capture/desktop_frame.h |
index 3cd839ca1b817e45f5e4cc7954827c0d1393a0f7..9a0c47f74ed7990dc31e97dc4235b7b22f2e6da7 100644 |
--- a/webrtc/modules/desktop_capture/desktop_frame.h |
+++ b/webrtc/modules/desktop_capture/desktop_frame.h |
@@ -29,47 +29,48 @@ class DesktopFrame { |
virtual ~DesktopFrame(); |
// Size of the frame. |
- const DesktopSize& size() const { return size_; } |
+ virtual const DesktopSize& size() const; |
Sergey Ulanov
2016/04/08 21:22:26
Why do you need to make any of these methods virtu
|
// Distance in the buffer between two neighboring rows in bytes. |
- int stride() const { return stride_; } |
+ virtual int stride() const; |
// Data buffer used for the frame. |
- uint8_t* data() const { return data_; } |
+ virtual uint8_t* data() const; |
// SharedMemory used for the buffer or NULL if memory is allocated on the |
// heap. The result is guaranteed to be deleted only after the frame is |
// deleted (classes that inherit from DesktopFrame must ensure it). |
- SharedMemory* shared_memory() const { return shared_memory_; } |
+ virtual SharedMemory* shared_memory() const; |
// Indicates region of the screen that has changed since the previous frame. |
- const DesktopRegion& updated_region() const { return updated_region_; } |
- DesktopRegion* mutable_updated_region() { return &updated_region_; } |
+ virtual const DesktopRegion& updated_region() const; |
+ virtual DesktopRegion* mutable_updated_region(); |
// DPI of the screen being captured. May be set to zero, e.g. if DPI is |
// unknown. |
- const DesktopVector& dpi() const { return dpi_; } |
- void set_dpi(const DesktopVector& dpi) { dpi_ = dpi; } |
+ virtual const DesktopVector& dpi() const; |
+ virtual void set_dpi(const DesktopVector& dpi); |
// Time taken to capture the frame in milliseconds. |
- int64_t capture_time_ms() const { return capture_time_ms_; } |
- void set_capture_time_ms(int64_t time_ms) { capture_time_ms_ = time_ms; } |
+ virtual int64_t capture_time_ms() const; |
+ virtual void set_capture_time_ms(int64_t time_ms); |
// Optional shape for the frame. Frames may be shaped e.g. if |
// capturing the contents of a shaped window. |
- const DesktopRegion* shape() const { return shape_.get(); } |
- void set_shape(DesktopRegion* shape) { shape_.reset(shape); } |
+ virtual const DesktopRegion* shape() const; |
+ virtual void set_shape(DesktopRegion* shape); |
// Copies pixels from a buffer or another frame. |dest_rect| rect must lay |
// within bounds of this frame. |
- void CopyPixelsFrom(uint8_t* src_buffer, int src_stride, |
- const DesktopRect& dest_rect); |
- void CopyPixelsFrom(const DesktopFrame& src_frame, |
- const DesktopVector& src_pos, |
- const DesktopRect& dest_rect); |
+ virtual void CopyPixelsFrom(uint8_t* src_buffer, |
+ int src_stride, |
+ const DesktopRect& dest_rect); |
+ virtual void CopyPixelsFrom(const DesktopFrame& src_frame, |
+ const DesktopVector& src_pos, |
+ const DesktopRect& dest_rect); |
// A helper to return the data pointer of a frame at the specified position. |
- uint8_t* GetFrameDataAtPos(const DesktopVector& pos) const; |
+ virtual uint8_t* GetFrameDataAtPos(const DesktopVector& pos) const; |
protected: |
DesktopFrame(DesktopSize size, |
@@ -77,12 +78,14 @@ class DesktopFrame { |
uint8_t* data, |
SharedMemory* shared_memory); |
+ // TODO(zijiehe): Most of follow variables should belong to an inheritance. |
const DesktopSize size_; |
const int stride_; |
// Ownership of the buffers is defined by the classes that inherit from this |
// class. They must guarantee that the buffer is not deleted before the frame |
// is deleted. |
+ // Inheritances can set the pointer after construction. |
uint8_t* const data_; |
SharedMemory* const shared_memory_; |