Index: media/base/video_frame.cc |
diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc |
index bc5e8e779a7052afab5503dbe7e02d00a87a6682..2de6bd36d5cdffb60956aa515a3824671db29b7d 100644 |
--- a/media/base/video_frame.cc |
+++ b/media/base/video_frame.cc |
@@ -287,6 +287,48 @@ scoped_refptr<VideoFrame> VideoFrame::WrapExternalYuvGpuMemoryBuffers( |
return frame; |
} |
+// static |
+scoped_refptr<VideoFrame> VideoFrame::WrapExternalYuvaData( |
+ VideoPixelFormat format, |
+ const gfx::Size& coded_size, |
+ const gfx::Rect& visible_rect, |
+ const gfx::Size& natural_size, |
+ int32_t y_stride, |
+ int32_t u_stride, |
+ int32_t v_stride, |
+ int32_t a_stride, |
+ uint8_t* y_data, |
+ uint8_t* u_data, |
+ uint8_t* v_data, |
+ uint8_t* a_data, |
+ base::TimeDelta timestamp) { |
+ const StorageType storage = STORAGE_UNOWNED_MEMORY; |
+ if (!IsValidConfig(format, storage, coded_size, visible_rect, natural_size)) { |
+ LOG(DFATAL) << __FUNCTION__ << " Invalid config." |
+ << ConfigToString(format, storage, coded_size, visible_rect, |
+ natural_size); |
+ return nullptr; |
+ } |
+ |
+ if (NumPlanes(format) != 4) { |
+ LOG(DFATAL) << "Expecting Y, U, V and A planes to be present for the video" |
+ << " format."; |
+ return nullptr; |
+ } |
+ |
+ scoped_refptr<VideoFrame> frame(new VideoFrame( |
+ format, storage, coded_size, visible_rect, natural_size, timestamp)); |
+ frame->strides_[kYPlane] = y_stride; |
+ frame->strides_[kUPlane] = u_stride; |
+ frame->strides_[kVPlane] = v_stride; |
+ frame->strides_[kAPlane] = a_stride; |
+ frame->data_[kYPlane] = y_data; |
+ frame->data_[kUPlane] = u_data; |
+ frame->data_[kVPlane] = v_data; |
+ frame->data_[kAPlane] = a_data; |
+ return frame; |
+} |
+ |
#if defined(OS_LINUX) |
// static |
scoped_refptr<VideoFrame> VideoFrame::WrapExternalDmabufs( |