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

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..273c9f755f819d18dbb2d333d832709aa6a559c9 100644
--- a/media/base/video_frame_unittest.cc
+++ b/media/base/video_frame_unittest.cc
@@ -158,6 +158,24 @@ 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.
+ for (size_t i = 0; i < VideoFrame::NumPlanes(frame->format()); ++i)
mcasas 2015/09/05 01:29:25 nit: please add a TODO to extend this part here to
emircan 2015/09/05 01:39:50 Done.
+ 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