Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(704)

Unified Diff: media/base/video_frame_pool.cc

Issue 1267003004: Revert to zero-initializing buffers for FFmpegVideoDecoder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Zero initialize only the planes. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/base/video_frame_pool.h ('k') | media/base/video_frame_pool_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/video_frame_pool.cc
diff --git a/media/base/video_frame_pool.cc b/media/base/video_frame_pool.cc
index 4951941d06be5d7ffe9e08e0959fb303ba7661c5..b834f82838b9d31c0ae0c60d9a0668444ecd5067 100644
--- a/media/base/video_frame_pool.cc
+++ b/media/base/video_frame_pool.cc
@@ -17,9 +17,7 @@ class VideoFramePool::PoolImpl
public:
PoolImpl();
- // Returns a frame from the pool that matches the specified
- // parameters or creates a new frame if no suitable frame exists in
- // the pool. The pool is drained if no matching frame is found.
+ // See VideoFramePool::CreateFrame() for usage.
scoped_refptr<VideoFrame> CreateFrame(VideoPixelFormat format,
const gfx::Size& coded_size,
const gfx::Rect& visible_rect,
@@ -81,8 +79,18 @@ scoped_refptr<VideoFrame> VideoFramePool::PoolImpl::CreateFrame(
}
if (!frame.get()) {
- frame = VideoFrame::CreateFrame(
- format, coded_size, visible_rect, natural_size, timestamp);
+ frame = VideoFrame::CreateFrame(format, coded_size, visible_rect,
+ natural_size, timestamp);
+
+ // Zero-initialize each plane of the buffer.
+ const size_t num_planes = VideoFrame::NumPlanes(frame->format());
+ for (size_t i = 0; i < num_planes; ++i) {
+ memset(frame->data(i),
+ 0,
+ VideoFrame::PlaneSize(frame->format(),
+ i,
+ frame->coded_size()).GetArea());
+ }
}
scoped_refptr<VideoFrame> wrapped_frame = VideoFrame::WrapVideoFrame(
« no previous file with comments | « media/base/video_frame_pool.h ('k') | media/base/video_frame_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698