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..3b274bd154187f57cb41ea2d472f273b05c4b35d 100644 |
--- a/media/base/video_frame_pool.cc |
+++ b/media/base/video_frame_pool.cc |
@@ -17,14 +17,13 @@ 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, |
const gfx::Size& natural_size, |
- base::TimeDelta timestamp); |
+ base::TimeDelta timestamp, |
+ bool zero_new_frames); |
// Shuts down the frame pool and releases all frames in |frames_|. |
// Once this is called frames will no longer be inserted back into |
@@ -60,7 +59,8 @@ scoped_refptr<VideoFrame> VideoFramePool::PoolImpl::CreateFrame( |
const gfx::Size& coded_size, |
const gfx::Rect& visible_rect, |
const gfx::Size& natural_size, |
- base::TimeDelta timestamp) { |
+ base::TimeDelta timestamp, |
+ bool zero_new_frames) { |
base::AutoLock auto_lock(lock_); |
DCHECK(!is_shutdown_); |
@@ -83,6 +83,8 @@ scoped_refptr<VideoFrame> VideoFramePool::PoolImpl::CreateFrame( |
if (!frame.get()) { |
frame = VideoFrame::CreateFrame( |
format, coded_size, visible_rect, natural_size, timestamp); |
+ if (zero_new_frames) |
+ memset(frame->data(0), 0, VideoFrame::AlignedAllocationSize(frame)); |
} |
scoped_refptr<VideoFrame> wrapped_frame = VideoFrame::WrapVideoFrame( |
@@ -119,9 +121,10 @@ scoped_refptr<VideoFrame> VideoFramePool::CreateFrame( |
const gfx::Size& coded_size, |
const gfx::Rect& visible_rect, |
const gfx::Size& natural_size, |
- base::TimeDelta timestamp) { |
+ base::TimeDelta timestamp, |
+ bool zero_new_frames) { |
return pool_->CreateFrame(format, coded_size, visible_rect, natural_size, |
- timestamp); |
+ timestamp, zero_new_frames); |
} |
size_t VideoFramePool::GetPoolSizeForTesting() const { |