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

Unified Diff: media/base/video_frame_impl_unittest.cc

Issue 164403: Implemented end-of-stream callback for media::PipelineImpl. (Closed)
Patch Set: Baz Created 11 years, 4 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_impl.cc ('k') | media/filters/audio_renderer_base.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/video_frame_impl_unittest.cc
diff --git a/media/base/video_frame_impl_unittest.cc b/media/base/video_frame_impl_unittest.cc
index eeec716fc871d3767f9cb17a59b6969ac347d0e1..45e4553d18e3b91732474a0bd3a036fa3068096e 100644
--- a/media/base/video_frame_impl_unittest.cc
+++ b/media/base/video_frame_impl_unittest.cc
@@ -130,4 +130,46 @@ TEST(VideoFrameImpl, CreateFrame) {
EXPECT_TRUE(frame->IsEndOfStream());
}
+TEST(VideoFrameImpl, CreateBlackFrame) {
+ const size_t kWidth = 2;
+ const size_t kHeight = 2;
+ const uint8 kExpectedYRow[] = { 0, 0 };
+ const uint8 kExpectedUVRow[] = { 128 };
+
+ scoped_refptr<media::VideoFrame> frame;
+ VideoFrameImpl::CreateBlackFrame(kWidth, kHeight, &frame);
+ ASSERT_TRUE(frame);
+
+ // Test basic properties.
+ EXPECT_EQ(0, frame->GetTimestamp().InMicroseconds());
+ EXPECT_EQ(0, frame->GetDuration().InMicroseconds());
+ EXPECT_FALSE(frame->IsEndOfStream());
+
+ // Test surface properties.
+ VideoSurface surface;
+ EXPECT_TRUE(frame->Lock(&surface));
+ EXPECT_EQ(VideoSurface::YV12, surface.format);
+ EXPECT_EQ(kWidth, surface.width);
+ EXPECT_EQ(kHeight, surface.height);
+ EXPECT_EQ(3u, surface.planes);
+
+ // Test surfaces themselves.
+ for (size_t y = 0; y < surface.height; ++y) {
+ EXPECT_EQ(0, memcmp(kExpectedYRow, surface.data[VideoSurface::kYPlane],
+ arraysize(kExpectedYRow)));
+ surface.data[VideoSurface::kYPlane] +=
+ surface.strides[VideoSurface::kYPlane];
+ }
+ for (size_t y = 0; y < surface.height / 2; ++y) {
+ EXPECT_EQ(0, memcmp(kExpectedUVRow, surface.data[VideoSurface::kUPlane],
+ arraysize(kExpectedUVRow)));
+ EXPECT_EQ(0, memcmp(kExpectedUVRow, surface.data[VideoSurface::kVPlane],
+ arraysize(kExpectedUVRow)));
+ surface.data[VideoSurface::kUPlane] +=
+ surface.strides[VideoSurface::kUPlane];
+ surface.data[VideoSurface::kVPlane] +=
+ surface.strides[VideoSurface::kVPlane];
+ }
+}
+
} // namespace media
« no previous file with comments | « media/base/video_frame_impl.cc ('k') | media/filters/audio_renderer_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698