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

Unified Diff: media/base/video_frame_unittest.cc

Issue 1313413010: Add VideoFrame::CreateZeroInitializedFrame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/video_frame_unittest.cc
diff --git a/media/base/video_frame_unittest.cc b/media/base/video_frame_unittest.cc
index f1afcc8186c18039eceaf4e15bd6a9b415ca4f3b..bcc8cf92d0b19539441f844528704f5d2bbb039b 100644
--- a/media/base/video_frame_unittest.cc
+++ b/media/base/video_frame_unittest.cc
@@ -158,6 +158,26 @@ TEST(VideoFrame, CreateFrame) {
frame->metadata()->IsTrue(VideoFrameMetadata::END_OF_STREAM));
}
+TEST(VideoFrame, CreateZeroInitializedFrame) {
+ const int kWidth = 2;
+ const int kHeight = 2;
+ const base::TimeDelta kTimestamp = base::TimeDelta::FromMicroseconds(1337);
+
+ // Create a YV12 Video Frame.
+ gfx::Size size(kWidth, kHeight);
+ scoped_refptr<media::VideoFrame> frame =
+ VideoFrame::CreateZeroInitializedFrame(media::PIXEL_FORMAT_YV12, size,
+ gfx::Rect(size), size, kTimestamp);
+ ASSERT_TRUE(frame.get());
+ EXPECT_TRUE(frame->IsMappable());
+
+ // Verify that frame is initialized with zeros.
+ // TODO(emircan): Check all the contents when we know the exact size of the
+ // allocated buffer.
+ for (size_t i = 0; i < VideoFrame::NumPlanes(frame->format()); ++i)
+ EXPECT_EQ(0, frame->data(i)[0]);
+}
+
TEST(VideoFrame, CreateBlackFrame) {
const int kWidth = 2;
const int kHeight = 2;
« no previous file with comments | « media/base/video_frame_pool.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698