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

Unified Diff: cc/layers/video_layer_impl_unittest.cc

Issue 1125303005: cc: VideoLayerImpl VideoFrame::TEXTURE_YUV_420 support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: No alpha for native textures. DCHECK_IMPLIES. Created 5 years, 7 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 | « cc/layers/video_layer_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/layers/video_layer_impl_unittest.cc
diff --git a/cc/layers/video_layer_impl_unittest.cc b/cc/layers/video_layer_impl_unittest.cc
index 57ad33a5840e2137cf3f7987776ff44b495735d1..40ab5b7dbe4b1ee4917224399503176a0450915a 100644
--- a/cc/layers/video_layer_impl_unittest.cc
+++ b/cc/layers/video_layer_impl_unittest.cc
@@ -8,6 +8,7 @@
#include "cc/output/context_provider.h"
#include "cc/output/output_surface.h"
#include "cc/quads/draw_quad.h"
+#include "cc/quads/yuv_video_draw_quad.h"
#include "cc/test/fake_video_frame_provider.h"
#include "cc/test/layer_test_common.h"
#include "cc/trees/single_thread_proxy.h"
@@ -245,5 +246,85 @@ TEST(VideoLayerImplTest, Rotated270) {
EXPECT_EQ(gfx::Point3F(0, 0, 0), p2);
}
+void EmptyCallback(unsigned sync_point) {
+}
+
+TEST(VideoLayerImplTest, SoftwareVideoFrameGeneratesYUVQuad) {
+ gfx::Size layer_size(1000, 1000);
+ gfx::Size viewport_size(1000, 1000);
+
+ LayerTestCommon::LayerImplTest impl;
+ DebugSetImplThreadAndMainThreadBlocked(impl.proxy());
+
+ gpu::MailboxHolder mailbox_holder;
+ mailbox_holder.mailbox.name[0] = 1;
+
+ scoped_refptr<media::VideoFrame> video_frame = media::VideoFrame::CreateFrame(
+ media::VideoFrame::YV12, gfx::Size(20, 10), gfx::Rect(20, 10),
+ gfx::Size(20, 10), base::TimeDelta());
+
+ FakeVideoFrameProvider provider;
+ provider.set_frame(video_frame);
+
+ VideoLayerImpl* video_layer_impl =
+ impl.AddChildToRoot<VideoLayerImpl>(&provider, media::VIDEO_ROTATION_0);
+ video_layer_impl->SetBounds(layer_size);
+ video_layer_impl->SetContentBounds(layer_size);
+ video_layer_impl->SetDrawsContent(true);
+
+ gfx::Rect occluded;
+ impl.AppendQuadsWithOcclusion(video_layer_impl, occluded);
+
+ EXPECT_EQ(1u, impl.quad_list().size());
+ const DrawQuad* draw_quad = impl.quad_list().ElementAt(0);
+ ASSERT_EQ(DrawQuad::YUV_VIDEO_CONTENT, draw_quad->material);
+
+ const YUVVideoDrawQuad* yuv_draw_quad =
+ static_cast<const YUVVideoDrawQuad*>(draw_quad);
+ EXPECT_EQ(yuv_draw_quad->uv_tex_size.height(),
+ (yuv_draw_quad->ya_tex_size.height() + 1) / 2);
+ EXPECT_EQ(yuv_draw_quad->uv_tex_size.width(),
+ (yuv_draw_quad->ya_tex_size.width() + 1) / 2);
+}
+
+TEST(VideoLayerImplTest, NativeYUVFrameGeneratesYUVQuad) {
+ gfx::Size layer_size(1000, 1000);
+ gfx::Size viewport_size(1000, 1000);
+
+ LayerTestCommon::LayerImplTest impl;
+ DebugSetImplThreadAndMainThreadBlocked(impl.proxy());
+
+ gpu::MailboxHolder mailbox_holder;
+ mailbox_holder.mailbox.name[0] = 1;
+
+ scoped_refptr<media::VideoFrame> video_frame =
+ media::VideoFrame::WrapYUV420NativeTextures(
+ mailbox_holder, mailbox_holder, mailbox_holder,
+ base::Bind(EmptyCallback), gfx::Size(10, 10), gfx::Rect(10, 10),
+ gfx::Size(10, 10), base::TimeDelta(), true);
+ FakeVideoFrameProvider provider;
+ provider.set_frame(video_frame);
+
+ VideoLayerImpl* video_layer_impl =
+ impl.AddChildToRoot<VideoLayerImpl>(&provider, media::VIDEO_ROTATION_0);
+ video_layer_impl->SetBounds(layer_size);
+ video_layer_impl->SetContentBounds(layer_size);
+ video_layer_impl->SetDrawsContent(true);
+
+ gfx::Rect occluded;
+ impl.AppendQuadsWithOcclusion(video_layer_impl, occluded);
+
+ EXPECT_EQ(1u, impl.quad_list().size());
+ const DrawQuad* draw_quad = impl.quad_list().ElementAt(0);
+ ASSERT_EQ(DrawQuad::YUV_VIDEO_CONTENT, draw_quad->material);
+
+ const YUVVideoDrawQuad* yuv_draw_quad =
+ static_cast<const YUVVideoDrawQuad*>(draw_quad);
+ EXPECT_EQ(yuv_draw_quad->uv_tex_size.height(),
+ (yuv_draw_quad->ya_tex_size.height() + 1) / 2);
+ EXPECT_EQ(yuv_draw_quad->uv_tex_size.width(),
+ (yuv_draw_quad->ya_tex_size.width() + 1) / 2);
+}
+
} // namespace
} // namespace cc
« no previous file with comments | « cc/layers/video_layer_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698