OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/resources/video_resource_updater.h" | 5 #include "cc/resources/video_resource_updater.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
7 #include "cc/resources/resource_provider.h" | 10 #include "cc/resources/resource_provider.h" |
8 #include "cc/test/fake_output_surface.h" | 11 #include "cc/test/fake_output_surface.h" |
9 #include "cc/test/fake_output_surface_client.h" | 12 #include "cc/test/fake_output_surface_client.h" |
10 #include "cc/test/fake_resource_provider.h" | 13 #include "cc/test/fake_resource_provider.h" |
11 #include "cc/test/test_shared_bitmap_manager.h" | 14 #include "cc/test/test_shared_bitmap_manager.h" |
12 #include "cc/test/test_web_graphics_context_3d.h" | 15 #include "cc/test/test_web_graphics_context_3d.h" |
13 #include "cc/trees/blocking_task_runner.h" | 16 #include "cc/trees/blocking_task_runner.h" |
14 #include "gpu/GLES2/gl2extchromium.h" | 17 #include "gpu/GLES2/gl2extchromium.h" |
15 #include "media/base/video_frame.h" | 18 #include "media/base/video_frame.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 resource_provider3d_ = FakeResourceProvider::Create( | 76 resource_provider3d_ = FakeResourceProvider::Create( |
74 output_surface3d_.get(), shared_bitmap_manager_.get()); | 77 output_surface3d_.get(), shared_bitmap_manager_.get()); |
75 | 78 |
76 resource_provider_software_ = FakeResourceProvider::Create( | 79 resource_provider_software_ = FakeResourceProvider::Create( |
77 output_surface_software_.get(), shared_bitmap_manager_.get()); | 80 output_surface_software_.get(), shared_bitmap_manager_.get()); |
78 } | 81 } |
79 | 82 |
80 scoped_refptr<media::VideoFrame> CreateTestYUVVideoFrame() { | 83 scoped_refptr<media::VideoFrame> CreateTestYUVVideoFrame() { |
81 const int kDimension = 10; | 84 const int kDimension = 10; |
82 gfx::Size size(kDimension, kDimension); | 85 gfx::Size size(kDimension, kDimension); |
83 static uint8 y_data[kDimension * kDimension] = { 0 }; | 86 static uint8_t y_data[kDimension * kDimension] = {0}; |
84 static uint8 u_data[kDimension * kDimension / 2] = { 0 }; | 87 static uint8_t u_data[kDimension * kDimension / 2] = {0}; |
85 static uint8 v_data[kDimension * kDimension / 2] = { 0 }; | 88 static uint8_t v_data[kDimension * kDimension / 2] = {0}; |
86 | 89 |
87 return media::VideoFrame::WrapExternalYuvData( | 90 return media::VideoFrame::WrapExternalYuvData( |
88 media::PIXEL_FORMAT_YV16, // format | 91 media::PIXEL_FORMAT_YV16, // format |
89 size, // coded_size | 92 size, // coded_size |
90 gfx::Rect(size), // visible_rect | 93 gfx::Rect(size), // visible_rect |
91 size, // natural_size | 94 size, // natural_size |
92 size.width(), // y_stride | 95 size.width(), // y_stride |
93 size.width() / 2, // u_stride | 96 size.width() / 2, // u_stride |
94 size.width() / 2, // v_stride | 97 size.width() / 2, // v_stride |
95 y_data, // y_data | 98 y_data, // y_data |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 | 310 |
308 resources = updater.CreateExternalResourcesFromVideoFrame(video_frame); | 311 resources = updater.CreateExternalResourcesFromVideoFrame(video_frame); |
309 EXPECT_EQ(VideoFrameExternalResources::YUV_RESOURCE, resources.type); | 312 EXPECT_EQ(VideoFrameExternalResources::YUV_RESOURCE, resources.type); |
310 EXPECT_TRUE(resources.read_lock_fences_enabled); | 313 EXPECT_TRUE(resources.read_lock_fences_enabled); |
311 EXPECT_EQ(3u, resources.mailboxes.size()); | 314 EXPECT_EQ(3u, resources.mailboxes.size()); |
312 EXPECT_EQ(3u, resources.release_callbacks.size()); | 315 EXPECT_EQ(3u, resources.release_callbacks.size()); |
313 EXPECT_EQ(0u, resources.software_resources.size()); | 316 EXPECT_EQ(0u, resources.software_resources.size()); |
314 } | 317 } |
315 } // namespace | 318 } // namespace |
316 } // namespace cc | 319 } // namespace cc |
OLD | NEW |