Chromium Code Reviews| Index: media/base/video_frame.cc |
| diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc |
| index 4a9636ffcf3bdd2c4edbc92415bb3b0416d3dddd..13797806279854f6d17d9d0f29d668d55a7de354 100644 |
| --- a/media/base/video_frame.cc |
| +++ b/media/base/video_frame.cc |
| @@ -375,6 +375,47 @@ 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)) { |
| + DLOG(ERROR) << __FUNCTION__ << " Invalid config." |
| + << ConfigToString(format, storage, coded_size, visible_rect, |
| + natural_size); |
| + return nullptr; |
| + } |
| + |
| + if (NumPlanes(format) != 4) { |
| + DLOG(ERROR) << "Not expecting alpha for the video format."; |
|
DaleCurtis
2016/01/13 01:32:28
Fix message. Expecting YUVA planes, etc.
vignesh
2016/01/15 18:07:13
Done.
|
| + 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( |