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

Unified Diff: media/base/video_frame_pool.cc

Issue 1227383003: Remove memset from VideoFrame and mark buffer as unpoisoned (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dalecurtis@ comments Created 5 years, 5 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
Index: media/base/video_frame_pool.cc
diff --git a/media/base/video_frame_pool.cc b/media/base/video_frame_pool.cc
index ac021348c14e82d6fe6e2fcd011838fc23c0a58a..44bd349f4281cd5bd8f80c75dc3ece63e1147e13 100644
--- a/media/base/video_frame_pool.cc
+++ b/media/base/video_frame_pool.cc
@@ -24,7 +24,8 @@ class VideoFramePool::PoolImpl
const gfx::Size& coded_size,
const gfx::Rect& visible_rect,
const gfx::Size& natural_size,
- base::TimeDelta timestamp);
+ base::TimeDelta timestamp,
+ bool zero_out_memory);
DaleCurtis 2015/07/09 22:21:16 This is a bit confusing since it would only happen
emircan 2015/07/09 23:16:27 True, I will go with "zero_init_new_allocations".
// 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 +61,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_out_memory) {
base::AutoLock auto_lock(lock_);
DCHECK(!is_shutdown_);
@@ -83,6 +85,8 @@ scoped_refptr<VideoFrame> VideoFramePool::PoolImpl::CreateFrame(
if (!frame.get()) {
frame = VideoFrame::CreateFrame(
format, coded_size, visible_rect, natural_size, timestamp);
+ if (zero_out_memory)
+ memset(frame->data(0), 0, VideoFrame::AlignedAllocationSize(frame));
}
scoped_refptr<VideoFrame> wrapped_frame = VideoFrame::WrapVideoFrame(
@@ -119,9 +123,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_out_memory) {
return pool_->CreateFrame(format, coded_size, visible_rect, natural_size,
- timestamp);
+ timestamp, zero_out_memory);
}
size_t VideoFramePool::GetPoolSizeForTesting() const {

Powered by Google App Engine
This is Rietveld 408576698