| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 y_data[kDimension * kDimension] = {0}; |
| 67 static uint8 u_data[kDimension * kDimension / 2] = {0}; | 67 static uint8 u_data[kDimension * kDimension / 2] = {0}; |
| 68 static uint8 v_data[kDimension * kDimension / 2] = {0}; | 68 static uint8 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 scoped_refptr<VideoFrame> video_frame = |
| 74 media::PIXEL_FORMAT_YV12, // format | 74 media::VideoFrame::WrapExternalYuvData( |
| 75 size, // coded_size | 75 media::PIXEL_FORMAT_YV12, // format |
| 76 gfx::Rect(size), // visible_rect | 76 size, // coded_size |
| 77 size, // natural_size | 77 gfx::Rect(size), // visible_rect |
| 78 size.width(), // y_stride | 78 size, // natural_size |
| 79 size.width() / 2, // u_stride | 79 size.width(), // y_stride |
| 80 size.width() / 2, // v_stride | 80 size.width() / 2, // u_stride |
| 81 y_data, // y_data | 81 size.width() / 2, // v_stride |
| 82 u_data, // u_data | 82 y_data, // y_data |
| 83 v_data, // v_data | 83 u_data, // u_data |
| 84 base::TimeDelta()); // timestamp | 84 v_data, // v_data |
| 85 base::TimeDelta()); // timestamp |
| 86 CHECK(video_frame); |
| 87 return video_frame; |
| 85 } | 88 } |
| 86 | 89 |
| 87 protected: | 90 protected: |
| 88 scoped_ptr<MockGpuVideoAcceleratorFactories> mock_gpu_factories_; | 91 scoped_ptr<MockGpuVideoAcceleratorFactories> mock_gpu_factories_; |
| 89 scoped_ptr<GpuMemoryBufferVideoFramePool> gpu_memory_buffer_pool_; | 92 scoped_ptr<GpuMemoryBufferVideoFramePool> gpu_memory_buffer_pool_; |
| 90 scoped_refptr<base::TestSimpleTaskRunner> media_task_runner_; | 93 scoped_refptr<base::TestSimpleTaskRunner> media_task_runner_; |
| 91 scoped_refptr<base::TestSimpleTaskRunner> copy_task_runner_; | 94 scoped_refptr<base::TestSimpleTaskRunner> copy_task_runner_; |
| 92 scoped_ptr<TestGLES2Interface> gles2_; | 95 scoped_ptr<TestGLES2Interface> gles2_; |
| 93 }; | 96 }; |
| 94 | 97 |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 gpu_memory_buffer_pool_->MaybeCreateHardwareFrame( | 213 gpu_memory_buffer_pool_->MaybeCreateHardwareFrame( |
| 211 software_frame, base::Bind(MaybeCreateHardwareFrameCallback, &frame)); | 214 software_frame, base::Bind(MaybeCreateHardwareFrameCallback, &frame)); |
| 212 | 215 |
| 213 RunUntilIdle(); | 216 RunUntilIdle(); |
| 214 | 217 |
| 215 EXPECT_NE(software_frame.get(), frame.get()); | 218 EXPECT_NE(software_frame.get(), frame.get()); |
| 216 EXPECT_EQ(3u, gles2_->gen_textures); | 219 EXPECT_EQ(3u, gles2_->gen_textures); |
| 217 } | 220 } |
| 218 | 221 |
| 219 } // namespace media | 222 } // namespace media |
| OLD | NEW |