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 1ee97531b07aac91a9b169a08ddbba3c9b5e1477..e4a697f93e782ce858103a24cc8f782c25eef6c0 100644 |
--- a/webrtc/common_video/video_frame_buffer.cc |
+++ b/webrtc/common_video/video_frame_buffer.cc |
@@ -61,10 +61,12 @@ I420Buffer::I420Buffer(int width, |
I420Buffer::~I420Buffer() { |
} |
+// static |
rtc::scoped_refptr<I420Buffer> I420Buffer::Create(int width, int height) { |
return new rtc::RefCountedObject<I420Buffer>(width, height); |
} |
+// static |
rtc::scoped_refptr<I420Buffer> I420Buffer::Create(int width, |
int height, |
int stride_y, |
@@ -128,19 +130,30 @@ rtc::scoped_refptr<VideoFrameBuffer> I420Buffer::NativeToI420Buffer() { |
// static |
rtc::scoped_refptr<I420Buffer> I420Buffer::Copy( |
+ int width, int height, |
+ const uint8_t* data_y, int stride_y, |
+ const uint8_t* data_u, int stride_u, |
+ const uint8_t* data_v, int stride_v) { |
+ // Note: May use different strides than the input data. |
+ rtc::scoped_refptr<I420Buffer> buffer = Create(width, height); |
+ RTC_CHECK(libyuv::I420Copy(data_y, stride_y, |
magjed_webrtc
2016/11/28 08:39:56
RTC_CHECK_EQ(0, ...)
nisse-webrtc
2016/11/28 09:44:54
Done.
|
+ data_u, stride_u, |
+ data_v, stride_v, |
+ buffer->MutableDataY(), buffer->StrideY(), |
+ buffer->MutableDataU(), buffer->StrideU(), |
+ buffer->MutableDataV(), buffer->StrideV(), |
+ width, height) |
+ == 0); |
+ return buffer; |
+} |
+ |
+// static |
+rtc::scoped_refptr<I420Buffer> I420Buffer::Copy( |
const VideoFrameBuffer& source) { |
- int width = source.width(); |
- int height = source.height(); |
- rtc::scoped_refptr<I420Buffer> target = I420Buffer::Create(width, height); |
- RTC_CHECK(libyuv::I420Copy(source.DataY(), source.StrideY(), |
- source.DataU(), source.StrideU(), |
- source.DataV(), source.StrideV(), |
- target->MutableDataY(), target->StrideY(), |
- target->MutableDataU(), target->StrideU(), |
- target->MutableDataV(), target->StrideV(), |
- width, height) == 0); |
- |
- return target; |
+ return Copy(source.width(), source.height(), |
+ source.DataY(), source.StrideY(), |
+ source.DataU(), source.StrideU(), |
+ source.DataV(), source.StrideV()); |
} |
void I420Buffer::SetToBlack() { |