| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/test/test_simple_task_runner.h" | 8 #include "base/test/test_simple_task_runner.h" |
| 9 #include "gpu/command_buffer/client/gles2_interface_stub.h" | 9 #include "gpu/command_buffer/client/gles2_interface_stub.h" |
| 10 #include "media/base/video_frame.h" | 10 #include "media/base/video_frame.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 static scoped_refptr<media::VideoFrame> CreateTestYUVVideoFrame( | 94 static scoped_refptr<media::VideoFrame> CreateTestYUVVideoFrame( |
| 95 int dimension) { | 95 int dimension) { |
| 96 const int kDimension = 10; | 96 const int kDimension = 10; |
| 97 static uint8_t y_data[kDimension * kDimension] = {0}; | 97 static uint8_t y_data[kDimension * kDimension] = {0}; |
| 98 static uint8_t u_data[kDimension * kDimension / 2] = {0}; | 98 static uint8_t u_data[kDimension * kDimension / 2] = {0}; |
| 99 static uint8_t v_data[kDimension * kDimension / 2] = {0}; | 99 static uint8_t v_data[kDimension * kDimension / 2] = {0}; |
| 100 | 100 |
| 101 DCHECK_LE(dimension, kDimension); | 101 DCHECK_LE(dimension, kDimension); |
| 102 gfx::Size size(dimension, dimension); | 102 gfx::Size size(dimension, dimension); |
| 103 | 103 |
| 104 return media::VideoFrame::WrapExternalYuvData( | 104 scoped_refptr<VideoFrame> video_frame = |
| 105 media::PIXEL_FORMAT_YV12, // format | 105 media::VideoFrame::WrapExternalYuvData( |
| 106 size, // coded_size | 106 media::PIXEL_FORMAT_YV12, // format |
| 107 gfx::Rect(size), // visible_rect | 107 size, // coded_size |
| 108 size, // natural_size | 108 gfx::Rect(size), // visible_rect |
| 109 size.width(), // y_stride | 109 size, // natural_size |
| 110 size.width() / 2, // u_stride | 110 size.width(), // y_stride |
| 111 size.width() / 2, // v_stride | 111 size.width() / 2, // u_stride |
| 112 y_data, // y_data | 112 size.width() / 2, // v_stride |
| 113 u_data, // u_data | 113 y_data, // y_data |
| 114 v_data, // v_data | 114 u_data, // u_data |
| 115 base::TimeDelta()); // timestamp | 115 v_data, // v_data |
| 116 base::TimeDelta()); // timestamp |
| 117 EXPECT_TRUE(video_frame); |
| 118 return video_frame; |
| 116 } | 119 } |
| 117 | 120 |
| 118 protected: | 121 protected: |
| 119 scoped_ptr<MockGpuVideoAcceleratorFactories> mock_gpu_factories_; | 122 scoped_ptr<MockGpuVideoAcceleratorFactories> mock_gpu_factories_; |
| 120 scoped_ptr<GpuMemoryBufferVideoFramePool> gpu_memory_buffer_pool_; | 123 scoped_ptr<GpuMemoryBufferVideoFramePool> gpu_memory_buffer_pool_; |
| 121 scoped_refptr<base::TestSimpleTaskRunner> media_task_runner_; | 124 scoped_refptr<base::TestSimpleTaskRunner> media_task_runner_; |
| 122 scoped_refptr<base::TestSimpleTaskRunner> copy_task_runner_; | 125 scoped_refptr<base::TestSimpleTaskRunner> copy_task_runner_; |
| 123 scoped_ptr<TestGLES2Interface> gles2_; | 126 scoped_ptr<TestGLES2Interface> gles2_; |
| 124 }; | 127 }; |
| 125 | 128 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 290 gpu_memory_buffer_pool_->MaybeCreateHardwareFrame( | 293 gpu_memory_buffer_pool_->MaybeCreateHardwareFrame( |
| 291 software_frame, base::Bind(MaybeCreateHardwareFrameCallback, &frame)); | 294 software_frame, base::Bind(MaybeCreateHardwareFrameCallback, &frame)); |
| 292 | 295 |
| 293 RunUntilIdle(); | 296 RunUntilIdle(); |
| 294 | 297 |
| 295 EXPECT_NE(software_frame.get(), frame.get()); | 298 EXPECT_NE(software_frame.get(), frame.get()); |
| 296 EXPECT_EQ(3u, gles2_->gen_textures); | 299 EXPECT_EQ(3u, gles2_->gen_textures); |
| 297 } | 300 } |
| 298 | 301 |
| 299 } // namespace media | 302 } // namespace media |
| OLD | NEW |