| Index: media/base/video_frame.cc
|
| diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc
|
| index 2009664099cab71b3369acd92068d7e3c8f04cff..242eb2fc6e8aa30e94b2d95d6fc18d6577195964 100644
|
| --- a/media/base/video_frame.cc
|
| +++ b/media/base/video_frame.cc
|
| @@ -195,6 +195,16 @@ scoped_refptr<VideoFrame> VideoFrame::CreateFrame(VideoPixelFormat format,
|
| const gfx::Rect& visible_rect,
|
| const gfx::Size& natural_size,
|
| base::TimeDelta timestamp) {
|
| + return CreateFrame(format, coded_size, visible_rect, natural_size, timestamp,
|
| + false);
|
| +}
|
| +
|
| +scoped_refptr<VideoFrame> VideoFrame::CreateFrame(VideoPixelFormat format,
|
| + const gfx::Size& coded_size,
|
| + const gfx::Rect& visible_rect,
|
| + const gfx::Size& natural_size,
|
| + base::TimeDelta timestamp,
|
| + bool zero_initialize_memory) {
|
| if (!IsYuvPlanar(format)) {
|
| NOTIMPLEMENTED();
|
| return nullptr;
|
| @@ -222,7 +232,7 @@ scoped_refptr<VideoFrame> VideoFrame::CreateFrame(VideoPixelFormat format,
|
|
|
| scoped_refptr<VideoFrame> frame(new VideoFrame(
|
| format, storage, new_coded_size, visible_rect, natural_size, timestamp));
|
| - frame->AllocateYUV();
|
| + frame->AllocateYUV(zero_initialize_memory);
|
| return frame;
|
| }
|
|
|
| @@ -897,7 +907,7 @@ VideoFrame::~VideoFrame() {
|
| base::ResetAndReturn(&callback).Run();
|
| }
|
|
|
| -void VideoFrame::AllocateYUV() {
|
| +void VideoFrame::AllocateYUV(bool zero_initialize_memory) {
|
| DCHECK_EQ(storage_type_, STORAGE_OWNED_MEMORY);
|
| static_assert(0 == kYPlane, "y plane data must be index 0");
|
|
|
| @@ -923,6 +933,8 @@ void VideoFrame::AllocateYUV() {
|
|
|
| uint8* data = reinterpret_cast<uint8*>(
|
| base::AlignedAlloc(data_size, kFrameAddressAlignment));
|
| + if (zero_initialize_memory)
|
| + memset(data, 0, data_size);
|
|
|
| for (size_t plane = 0; plane < NumPlanes(format_); ++plane)
|
| data_[plane] = data + offset[plane];
|
|
|