From f82109cb4d638826f8c795a9bcf41a51c258ba2d Mon Sep 17 00:00:00 2001 From: "magjed@webrtc.org" Date: Wed, 4 Mar 2015 11:30:29 +0000 Subject: [PATCH] Initialize memory in I420VideoFrame unittest Previously, when CreateEmptyFrame was called with a smaller size than before, we would reuse the allocation. Now, we allocate a new tight frame. The CL that made this change is https://webrtc-codereview.appspot.com/42469004/. This exposed an uninitialized memory problem in a I420VideoFrame unittest. This CL fixes that unittest. R=stefan@webrtc.org Review URL: https://webrtc-codereview.appspot.com/42619004 Cr-Commit-Position: refs/heads/master@{#8593} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8593 4adac7df-926f-26a2-2b94-8c16560cd09d --- webrtc/common_video/i420_video_frame_unittest.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/webrtc/common_video/i420_video_frame_unittest.cc b/webrtc/common_video/i420_video_frame_unittest.cc index 45e90166c0..9c0d700e34 100644 --- a/webrtc/common_video/i420_video_frame_unittest.cc +++ b/webrtc/common_video/i420_video_frame_unittest.cc @@ -108,6 +108,9 @@ TEST(TestI420VideoFrame, CopyFrame) { // Frame of larger dimensions. EXPECT_EQ(0, small_frame.CreateEmptyFrame(width, height, stride_y, stride_u, stride_v)); + memset(small_frame.buffer(kYPlane), 1, small_frame.allocated_size(kYPlane)); + memset(small_frame.buffer(kUPlane), 2, small_frame.allocated_size(kUPlane)); + memset(small_frame.buffer(kVPlane), 3, small_frame.allocated_size(kVPlane)); EXPECT_EQ(0, big_frame.CopyFrame(small_frame)); EXPECT_TRUE(EqualFrames(small_frame, big_frame)); }