| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "cc/layers/video_layer_impl.h" | 5 #include "cc/layers/video_layer_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "cc/layers/video_frame_provider_client_impl.h" | 9 #include "cc/layers/video_frame_provider_client_impl.h" |
| 10 #include "cc/output/context_provider.h" | 10 #include "cc/output/context_provider.h" |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 (yuv_draw_quad->ya_tex_size.width() + 1) / 2); | 329 (yuv_draw_quad->ya_tex_size.width() + 1) / 2); |
| 330 } | 330 } |
| 331 | 331 |
| 332 TEST(VideoLayerImplTest, NativeYUVFrameGeneratesYUVQuad) { | 332 TEST(VideoLayerImplTest, NativeYUVFrameGeneratesYUVQuad) { |
| 333 gfx::Size layer_size(1000, 1000); | 333 gfx::Size layer_size(1000, 1000); |
| 334 gfx::Size viewport_size(1000, 1000); | 334 gfx::Size viewport_size(1000, 1000); |
| 335 | 335 |
| 336 LayerTestCommon::LayerImplTest impl; | 336 LayerTestCommon::LayerImplTest impl; |
| 337 DebugSetImplThreadAndMainThreadBlocked(impl.task_runner_provider()); | 337 DebugSetImplThreadAndMainThreadBlocked(impl.task_runner_provider()); |
| 338 | 338 |
| 339 gpu::MailboxHolder mailbox_holder; | 339 gpu::MailboxHolder mailbox_holders[media::VideoFrame::kMaxPlanes]; |
| 340 mailbox_holder.mailbox.name[0] = 1; | 340 mailbox_holders[0].mailbox.name[0] = 1; |
| 341 mailbox_holders[1].mailbox.name[0] = 1; |
| 342 mailbox_holders[2].mailbox.name[0] = 1; |
| 341 | 343 |
| 342 scoped_refptr<media::VideoFrame> video_frame = | 344 scoped_refptr<media::VideoFrame> video_frame = |
| 343 media::VideoFrame::WrapYUV420NativeTextures( | 345 media::VideoFrame::WrapNativeTextures( |
| 344 mailbox_holder, mailbox_holder, mailbox_holder, | 346 media::PIXEL_FORMAT_I420, mailbox_holders, base::Bind(EmptyCallback), |
| 345 base::Bind(EmptyCallback), gfx::Size(10, 10), gfx::Rect(10, 10), | 347 gfx::Size(10, 10), gfx::Rect(10, 10), gfx::Size(10, 10), |
| 346 gfx::Size(10, 10), base::TimeDelta()); | 348 base::TimeDelta()); |
| 347 ASSERT_TRUE(video_frame); | 349 ASSERT_TRUE(video_frame); |
| 348 video_frame->metadata()->SetBoolean(media::VideoFrameMetadata::ALLOW_OVERLAY, | 350 video_frame->metadata()->SetBoolean(media::VideoFrameMetadata::ALLOW_OVERLAY, |
| 349 true); | 351 true); |
| 350 FakeVideoFrameProvider provider; | 352 FakeVideoFrameProvider provider; |
| 351 provider.set_frame(video_frame); | 353 provider.set_frame(video_frame); |
| 352 | 354 |
| 353 VideoLayerImpl* video_layer_impl = | 355 VideoLayerImpl* video_layer_impl = |
| 354 impl.AddChildToRoot<VideoLayerImpl>(&provider, media::VIDEO_ROTATION_0); | 356 impl.AddChildToRoot<VideoLayerImpl>(&provider, media::VIDEO_ROTATION_0); |
| 355 video_layer_impl->SetBounds(layer_size); | 357 video_layer_impl->SetBounds(layer_size); |
| 356 video_layer_impl->SetDrawsContent(true); | 358 video_layer_impl->SetDrawsContent(true); |
| 357 impl.host_impl()->active_tree()->BuildPropertyTreesForTesting(); | 359 impl.host_impl()->active_tree()->BuildPropertyTreesForTesting(); |
| 358 | 360 |
| 359 gfx::Rect occluded; | 361 gfx::Rect occluded; |
| 360 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded); | 362 impl.AppendQuadsWithOcclusion(video_layer_impl, occluded); |
| 361 | 363 |
| 362 EXPECT_EQ(1u, impl.quad_list().size()); | 364 EXPECT_EQ(1u, impl.quad_list().size()); |
| 363 const DrawQuad* draw_quad = impl.quad_list().ElementAt(0); | 365 const DrawQuad* draw_quad = impl.quad_list().ElementAt(0); |
| 364 ASSERT_EQ(DrawQuad::YUV_VIDEO_CONTENT, draw_quad->material); | 366 ASSERT_EQ(DrawQuad::YUV_VIDEO_CONTENT, draw_quad->material); |
| 365 | 367 |
| 366 const YUVVideoDrawQuad* yuv_draw_quad = | 368 const YUVVideoDrawQuad* yuv_draw_quad = |
| 367 static_cast<const YUVVideoDrawQuad*>(draw_quad); | 369 static_cast<const YUVVideoDrawQuad*>(draw_quad); |
| 368 EXPECT_EQ(yuv_draw_quad->uv_tex_size.height(), | 370 EXPECT_EQ(yuv_draw_quad->uv_tex_size.height(), |
| 369 (yuv_draw_quad->ya_tex_size.height() + 1) / 2); | 371 (yuv_draw_quad->ya_tex_size.height() + 1) / 2); |
| 370 EXPECT_EQ(yuv_draw_quad->uv_tex_size.width(), | 372 EXPECT_EQ(yuv_draw_quad->uv_tex_size.width(), |
| 371 (yuv_draw_quad->ya_tex_size.width() + 1) / 2); | 373 (yuv_draw_quad->ya_tex_size.width() + 1) / 2); |
| 372 } | 374 } |
| 373 | 375 |
| 374 } // namespace | 376 } // namespace |
| 375 } // namespace cc | 377 } // namespace cc |
| OLD | NEW |