OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/test/test_simple_task_runner.h" | 6 #include "base/test/test_simple_task_runner.h" |
7 #include "gpu/command_buffer/client/gles2_interface_stub.h" | 7 #include "gpu/command_buffer/client/gles2_interface_stub.h" |
8 #include "media/base/video_frame.h" | 8 #include "media/base/video_frame.h" |
9 #include "media/renderers/mock_gpu_video_accelerator_factories.h" | 9 #include "media/renderers/mock_gpu_video_accelerator_factories.h" |
10 #include "media/video/gpu_memory_buffer_video_frame_pool.h" | 10 #include "media/video/gpu_memory_buffer_video_frame_pool.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 void RunUntilIdle() { | 57 void RunUntilIdle() { |
58 media_task_runner_->RunUntilIdle(); | 58 media_task_runner_->RunUntilIdle(); |
59 copy_task_runner_->RunUntilIdle(); | 59 copy_task_runner_->RunUntilIdle(); |
60 media_task_runner_->RunUntilIdle(); | 60 media_task_runner_->RunUntilIdle(); |
61 } | 61 } |
62 | 62 |
63 static scoped_refptr<media::VideoFrame> CreateTestYUVVideoFrame( | 63 static scoped_refptr<media::VideoFrame> CreateTestYUVVideoFrame( |
64 int dimension) { | 64 int dimension) { |
65 const int kDimension = 10; | 65 const int kDimension = 10; |
66 static uint8 y_data[kDimension * kDimension] = {0}; | 66 static uint8_t y_data[kDimension * kDimension] = {0}; |
67 static uint8 u_data[kDimension * kDimension / 2] = {0}; | 67 static uint8_t u_data[kDimension * kDimension / 2] = {0}; |
68 static uint8 v_data[kDimension * kDimension / 2] = {0}; | 68 static uint8_t v_data[kDimension * kDimension / 2] = {0}; |
69 | 69 |
70 DCHECK_LE(dimension, kDimension); | 70 DCHECK_LE(dimension, kDimension); |
71 gfx::Size size(dimension, dimension); | 71 gfx::Size size(dimension, dimension); |
72 | 72 |
73 return media::VideoFrame::WrapExternalYuvData( | 73 return media::VideoFrame::WrapExternalYuvData( |
74 media::PIXEL_FORMAT_YV12, // format | 74 media::PIXEL_FORMAT_YV12, // format |
75 size, // coded_size | 75 size, // coded_size |
76 gfx::Rect(size), // visible_rect | 76 gfx::Rect(size), // visible_rect |
77 size, // natural_size | 77 size, // natural_size |
78 size.width(), // y_stride | 78 size.width(), // y_stride |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 gpu_memory_buffer_pool_->MaybeCreateHardwareFrame( | 210 gpu_memory_buffer_pool_->MaybeCreateHardwareFrame( |
211 software_frame, base::Bind(MaybeCreateHardwareFrameCallback, &frame)); | 211 software_frame, base::Bind(MaybeCreateHardwareFrameCallback, &frame)); |
212 | 212 |
213 RunUntilIdle(); | 213 RunUntilIdle(); |
214 | 214 |
215 EXPECT_NE(software_frame.get(), frame.get()); | 215 EXPECT_NE(software_frame.get(), frame.get()); |
216 EXPECT_EQ(3u, gles2_->gen_textures); | 216 EXPECT_EQ(3u, gles2_->gen_textures); |
217 } | 217 } |
218 | 218 |
219 } // namespace media | 219 } // namespace media |
OLD | NEW |