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

Side by Side Diff: media/base/video_frame_pool_unittest.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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/base/video_frame_pool.h" 5 #include "media/base/video_frame_pool.h"
6 #include "testing/gmock/include/gmock/gmock.h" 6 #include "testing/gmock/include/gmock/gmock.h"
7 7
8 namespace media { 8 namespace media {
9 9
10 class VideoFramePoolTest : public ::testing::Test { 10 class VideoFramePoolTest : public ::testing::Test {
11 public: 11 public:
12 VideoFramePoolTest() : pool_(new VideoFramePool()) {} 12 VideoFramePoolTest() : pool_(new VideoFramePool()) {}
13 13
14 scoped_refptr<VideoFrame> CreateFrame(VideoFrame::Format format, 14 scoped_refptr<VideoFrame> CreateFrame(VideoFrame::Format format,
15 int timestamp_ms) { 15 int timestamp_ms) {
16 gfx::Size coded_size(320,240); 16 gfx::Size coded_size(320,240);
17 gfx::Rect visible_rect(coded_size); 17 gfx::Rect visible_rect(coded_size);
18 gfx::Size natural_size(coded_size); 18 gfx::Size natural_size(coded_size);
19 19
20 scoped_refptr<VideoFrame> frame = 20 scoped_refptr<VideoFrame> frame = pool_->CreateFrame(
21 pool_->CreateFrame( 21 format, coded_size, visible_rect, natural_size,
22 format, coded_size, visible_rect, natural_size, 22 base::TimeDelta::FromMilliseconds(timestamp_ms), false);
23 base::TimeDelta::FromMilliseconds(timestamp_ms));
24 EXPECT_EQ(format, frame->format()); 23 EXPECT_EQ(format, frame->format());
25 EXPECT_EQ(base::TimeDelta::FromMilliseconds(timestamp_ms), 24 EXPECT_EQ(base::TimeDelta::FromMilliseconds(timestamp_ms),
26 frame->timestamp()); 25 frame->timestamp());
27 EXPECT_EQ(coded_size, frame->coded_size()); 26 EXPECT_EQ(coded_size, frame->coded_size());
28 EXPECT_EQ(visible_rect, frame->visible_rect()); 27 EXPECT_EQ(visible_rect, frame->visible_rect());
29 EXPECT_EQ(natural_size, frame->natural_size()); 28 EXPECT_EQ(natural_size, frame->natural_size());
30 29
31 return frame; 30 return frame;
32 } 31 }
33 32
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 // Destroy the pool. 73 // Destroy the pool.
75 pool_.reset(); 74 pool_.reset();
76 75
77 // Write to the Y plane. The memory tools should detect a 76 // Write to the Y plane. The memory tools should detect a
78 // use-after-free if the storage was actually removed by pool destruction. 77 // use-after-free if the storage was actually removed by pool destruction.
79 memset(frame->data(VideoFrame::kYPlane), 0xff, 78 memset(frame->data(VideoFrame::kYPlane), 0xff,
80 frame->rows(VideoFrame::kYPlane) * frame->stride(VideoFrame::kYPlane)); 79 frame->rows(VideoFrame::kYPlane) * frame->stride(VideoFrame::kYPlane));
81 } 80 }
82 81
83 } // namespace media 82 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698