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

Side by Side Diff: media/base/video_frame_unittest.cc

Issue 57403003: Remove EMPTY from VideoFrame::Format. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@vframe_rgb
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « media/base/video_frame.cc ('k') | media/filters/decrypting_video_decoder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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.h" 5 #include "media/base/video_frame.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/memory/aligned_memory.h" 10 #include "base/memory/aligned_memory.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 SCOPED_TRACE(""); 152 SCOPED_TRACE("");
153 InitializeYV12Frame(frame.get(), 1.0f); 153 InitializeYV12Frame(frame.get(), 1.0f);
154 ExpectFrameColor(frame.get(), 0xFFFFFFFF); 154 ExpectFrameColor(frame.get(), 0xFFFFFFFF);
155 } 155 }
156 base::MD5Init(&context); 156 base::MD5Init(&context);
157 frame->HashFrameForTesting(&context); 157 frame->HashFrameForTesting(&context);
158 base::MD5Final(&digest, &context); 158 base::MD5Final(&digest, &context);
159 EXPECT_EQ(MD5DigestToBase16(digest), "911991d51438ad2e1a40ed5f6fc7c796"); 159 EXPECT_EQ(MD5DigestToBase16(digest), "911991d51438ad2e1a40ed5f6fc7c796");
160 160
161 // Test an empty frame. 161 // Test an empty frame.
162 frame = VideoFrame::CreateEmptyFrame(); 162 frame = VideoFrame::CreateEOSFrame();
163 EXPECT_TRUE(frame->IsEndOfStream()); 163 EXPECT_TRUE(frame->end_of_stream());
164 } 164 }
165 165
166 TEST(VideoFrame, CreateBlackFrame) { 166 TEST(VideoFrame, CreateBlackFrame) {
167 const int kWidth = 2; 167 const int kWidth = 2;
168 const int kHeight = 2; 168 const int kHeight = 2;
169 const uint8 kExpectedYRow[] = { 0, 0 }; 169 const uint8 kExpectedYRow[] = { 0, 0 };
170 const uint8 kExpectedUVRow[] = { 128 }; 170 const uint8 kExpectedUVRow[] = { 128 };
171 171
172 scoped_refptr<media::VideoFrame> frame = 172 scoped_refptr<media::VideoFrame> frame =
173 VideoFrame::CreateBlackFrame(gfx::Size(kWidth, kHeight)); 173 VideoFrame::CreateBlackFrame(gfx::Size(kWidth, kHeight));
174 ASSERT_TRUE(frame.get()); 174 ASSERT_TRUE(frame.get());
175 175
176 // Test basic properties. 176 // Test basic properties.
177 EXPECT_EQ(0, frame->GetTimestamp().InMicroseconds()); 177 EXPECT_EQ(0, frame->GetTimestamp().InMicroseconds());
178 EXPECT_FALSE(frame->IsEndOfStream()); 178 EXPECT_FALSE(frame->end_of_stream());
179 179
180 // Test |frame| properties. 180 // Test |frame| properties.
181 EXPECT_EQ(VideoFrame::YV12, frame->format()); 181 EXPECT_EQ(VideoFrame::YV12, frame->format());
182 EXPECT_EQ(kWidth, frame->coded_size().width()); 182 EXPECT_EQ(kWidth, frame->coded_size().width());
183 EXPECT_EQ(kHeight, frame->coded_size().height()); 183 EXPECT_EQ(kHeight, frame->coded_size().height());
184 184
185 // Test frames themselves. 185 // Test frames themselves.
186 uint8* y_plane = frame->data(VideoFrame::kYPlane); 186 uint8* y_plane = frame->data(VideoFrame::kYPlane);
187 for (int y = 0; y < frame->coded_size().height(); ++y) { 187 for (int y = 0; y < frame->coded_size().height(); ++y) {
188 EXPECT_EQ(0, memcmp(kExpectedYRow, y_plane, arraysize(kExpectedYRow))); 188 EXPECT_EQ(0, memcmp(kExpectedYRow, y_plane, arraysize(kExpectedYRow)));
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
416 416
417 EXPECT_EQ(0u, called_sync_point); 417 EXPECT_EQ(0u, called_sync_point);
418 418
419 // Don't use the mailbox at all and drop our ref on it. 419 // Don't use the mailbox at all and drop our ref on it.
420 } 420 }
421 // The VideoFrame is destroyed, it should call the callback. 421 // The VideoFrame is destroyed, it should call the callback.
422 EXPECT_EQ(sync_point, called_sync_point); 422 EXPECT_EQ(sync_point, called_sync_point);
423 } 423 }
424 424
425 } // namespace media 425 } // namespace media
OLDNEW
« no previous file with comments | « media/base/video_frame.cc ('k') | media/filters/decrypting_video_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698