| Index: media/base/video_frame.cc
|
| diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc
|
| index c837159958739edb5d4d3708d1dab8af0bc45562..7fb7d5719f1ff6802da7479562a036ffaea468c4 100644
|
| --- a/media/base/video_frame.cc
|
| +++ b/media/base/video_frame.cc
|
| @@ -344,6 +344,29 @@ scoped_refptr<VideoFrame> VideoFrame::WrapExternalYuvData(
|
| return frame;
|
| }
|
|
|
| +// static
|
| +scoped_refptr<VideoFrame> VideoFrame::WrapExternalYuvConstData(
|
| + Format format,
|
| + const gfx::Size& coded_size,
|
| + const gfx::Rect& visible_rect,
|
| + const gfx::Size& natural_size,
|
| + int32 y_stride,
|
| + int32 u_stride,
|
| + int32 v_stride,
|
| + const uint8* y_data,
|
| + const uint8* u_data,
|
| + const uint8* v_data,
|
| + base::TimeDelta timestamp,
|
| + const base::Closure& no_longer_needed_cb) {
|
| + // Const cast is ok because the pointers will be protected by |is_read_only_|.
|
| + scoped_refptr<VideoFrame> frame = WrapExternalYuvData(
|
| + format, coded_size, visible_rect, natural_size, y_stride, u_stride,
|
| + v_stride, const_cast<uint8*>(y_data), const_cast<uint8*>(u_data),
|
| + const_cast<uint8*>(v_data), timestamp, no_longer_needed_cb);
|
| + frame->is_read_only_ = true;
|
| + return frame;
|
| +}
|
| +
|
| #if defined(OS_POSIX)
|
| // static
|
| scoped_refptr<VideoFrame> VideoFrame::WrapExternalDmabufs(
|
| @@ -671,6 +694,7 @@ VideoFrame::VideoFrame(VideoFrame::Format format,
|
| coded_size_(coded_size),
|
| visible_rect_(visible_rect),
|
| natural_size_(natural_size),
|
| + is_read_only_(false),
|
| mailbox_holder_(mailbox_holder.Pass()),
|
| shared_memory_handle_(base::SharedMemory::NULLHandle()),
|
| shared_memory_offset_(0),
|
| @@ -746,6 +770,7 @@ const uint8* VideoFrame::data(size_t plane) const {
|
|
|
| uint8* VideoFrame::data(size_t plane) {
|
| DCHECK(IsValidPlane(plane, format_));
|
| + DCHECK(!is_read_only_);
|
| return data_[plane];
|
| }
|
|
|
| @@ -767,6 +792,7 @@ const uint8* VideoFrame::visible_data(size_t plane) const {
|
| }
|
|
|
| uint8* VideoFrame::visible_data(size_t plane) {
|
| + DCHECK(!is_read_only_);
|
| return const_cast<uint8*>(
|
| static_cast<const VideoFrame*>(this)->visible_data(plane));
|
| }
|
|
|