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

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

Issue 2477233004: Update VideoFrameBuffer-related methods to not use references to scoped_refptr. (Closed)
Patch Set: Fix memory leak. Created 4 years, 1 month 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
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 0b5d863f28f9103091d9cc2615b7c9d6c8244a67..287624e59ec5076f72ad0d87a856a6fe8e0ba8b0 100644
--- a/webrtc/common_video/include/video_frame_buffer.h
+++ b/webrtc/common_video/include/video_frame_buffer.h
@@ -96,12 +96,11 @@ class I420Buffer : public VideoFrameBuffer {
rtc::scoped_refptr<VideoFrameBuffer> NativeToI420Buffer() override;
// Create a new buffer and copy the pixel data.
- static rtc::scoped_refptr<I420Buffer> Copy(
- const rtc::scoped_refptr<VideoFrameBuffer>& buffer);
+ static rtc::scoped_refptr<I420Buffer> Copy(const VideoFrameBuffer& buffer);
// Scale the cropped area of |src| to the size of |this| buffer, and
// write the result into |this|.
- void CropAndScaleFrom(const rtc::scoped_refptr<VideoFrameBuffer>& src,
+ void CropAndScaleFrom(const VideoFrameBuffer& src,
int offset_x,
int offset_y,
int crop_width,
@@ -109,16 +108,36 @@ class I420Buffer : public VideoFrameBuffer {
// The common case of a center crop, when needed to adjust the
// aspect ratio without distorting the image.
- void CropAndScaleFrom(const rtc::scoped_refptr<VideoFrameBuffer>& src);
+ void CropAndScaleFrom(const VideoFrameBuffer& src);
// Scale all of |src| to the size of |this| buffer, with no cropping.
- void ScaleFrom(const rtc::scoped_refptr<VideoFrameBuffer>& src);
+ void ScaleFrom(const VideoFrameBuffer& src);
+
+ // Deprecated methods, using smart pointer references.
+ // TODO(nisse): Delete once downstream applications are updated.
+ static rtc::scoped_refptr<I420Buffer> Copy(
+ const rtc::scoped_refptr<VideoFrameBuffer>& buffer) {
+ return Copy(*buffer);
+ }
+ void CropAndScaleFrom(const rtc::scoped_refptr<VideoFrameBuffer>& src,
+ int offset_x,
+ int offset_y,
+ int crop_width,
+ int crop_height) {
+ CropAndScaleFrom(*src, offset_x, offset_y, crop_width, crop_height);
+ }
+ void CropAndScaleFrom(const rtc::scoped_refptr<VideoFrameBuffer>& src) {
+ CropAndScaleFrom(*src);
+ }
+ void ScaleFrom(const rtc::scoped_refptr<VideoFrameBuffer>& src) {
+ ScaleFrom(*src);
+ }
// Returns a rotated versions of |src|. Native buffers are not
// supported. The reason this function doesn't return an I420Buffer,
// is that it returns |src| unchanged in case |rotation| is zero.
static rtc::scoped_refptr<VideoFrameBuffer> Rotate(
- const rtc::scoped_refptr<VideoFrameBuffer>& src,
+ rtc::scoped_refptr<VideoFrameBuffer> src,
VideoRotation rotation);
protected:

Powered by Google App Engine
This is Rietveld 408576698