| 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 static scoped_refptr<media::VideoFrame> CreateTestYUVVideoFrame( | 65 static scoped_refptr<media::VideoFrame> CreateTestYUVVideoFrame( |
| 66 int dimension) { | 66 int dimension) { |
| 67 const int kDimension = 10; | 67 const int kDimension = 10; |
| 68 static uint8_t y_data[kDimension * kDimension] = {0}; | 68 static uint8_t y_data[kDimension * kDimension] = {0}; |
| 69 static uint8_t u_data[kDimension * kDimension / 2] = {0}; | 69 static uint8_t u_data[kDimension * kDimension / 2] = {0}; |
| 70 static uint8_t v_data[kDimension * kDimension / 2] = {0}; | 70 static uint8_t v_data[kDimension * kDimension / 2] = {0}; |
| 71 | 71 |
| 72 DCHECK_LE(dimension, kDimension); | 72 DCHECK_LE(dimension, kDimension); |
| 73 gfx::Size size(dimension, dimension); | 73 gfx::Size size(dimension, dimension); |
| 74 | 74 |
| 75 return media::VideoFrame::WrapExternalYuvData( | 75 scoped_refptr<VideoFrame> video_frame = |
| 76 media::PIXEL_FORMAT_YV12, // format | 76 media::VideoFrame::WrapExternalYuvData( |
| 77 size, // coded_size | 77 media::PIXEL_FORMAT_YV12, // format |
| 78 gfx::Rect(size), // visible_rect | 78 size, // coded_size |
| 79 size, // natural_size | 79 gfx::Rect(size), // visible_rect |
| 80 size.width(), // y_stride | 80 size, // natural_size |
| 81 size.width() / 2, // u_stride | 81 size.width(), // y_stride |
| 82 size.width() / 2, // v_stride | 82 size.width() / 2, // u_stride |
| 83 y_data, // y_data | 83 size.width() / 2, // v_stride |
| 84 u_data, // u_data | 84 y_data, // y_data |
| 85 v_data, // v_data | 85 u_data, // u_data |
| 86 base::TimeDelta()); // timestamp | 86 v_data, // v_data |
| 87 base::TimeDelta()); // timestamp |
| 88 EXPECT_NE(nullptr, video_frame.get()); |
| 89 return video_frame; |
| 87 } | 90 } |
| 88 | 91 |
| 89 protected: | 92 protected: |
| 90 scoped_ptr<MockGpuVideoAcceleratorFactories> mock_gpu_factories_; | 93 scoped_ptr<MockGpuVideoAcceleratorFactories> mock_gpu_factories_; |
| 91 scoped_ptr<GpuMemoryBufferVideoFramePool> gpu_memory_buffer_pool_; | 94 scoped_ptr<GpuMemoryBufferVideoFramePool> gpu_memory_buffer_pool_; |
| 92 scoped_refptr<base::TestSimpleTaskRunner> media_task_runner_; | 95 scoped_refptr<base::TestSimpleTaskRunner> media_task_runner_; |
| 93 scoped_refptr<base::TestSimpleTaskRunner> copy_task_runner_; | 96 scoped_refptr<base::TestSimpleTaskRunner> copy_task_runner_; |
| 94 scoped_ptr<TestGLES2Interface> gles2_; | 97 scoped_ptr<TestGLES2Interface> gles2_; |
| 95 }; | 98 }; |
| 96 | 99 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 gpu_memory_buffer_pool_->MaybeCreateHardwareFrame( | 264 gpu_memory_buffer_pool_->MaybeCreateHardwareFrame( |
| 262 software_frame, base::Bind(MaybeCreateHardwareFrameCallback, &frame)); | 265 software_frame, base::Bind(MaybeCreateHardwareFrameCallback, &frame)); |
| 263 | 266 |
| 264 RunUntilIdle(); | 267 RunUntilIdle(); |
| 265 | 268 |
| 266 EXPECT_NE(software_frame.get(), frame.get()); | 269 EXPECT_NE(software_frame.get(), frame.get()); |
| 267 EXPECT_EQ(3u, gles2_->gen_textures); | 270 EXPECT_EQ(3u, gles2_->gen_textures); |
| 268 } | 271 } |
| 269 | 272 |
| 270 } // namespace media | 273 } // namespace media |
| OLD | NEW |