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 #include <memory> |
6 | 7 |
7 #include "base/bind.h" | 8 #include "base/bind.h" |
8 #include "base/test/test_simple_task_runner.h" | 9 #include "base/test/test_simple_task_runner.h" |
9 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
10 #include "gpu/command_buffer/client/gles2_interface_stub.h" | 11 #include "gpu/command_buffer/client/gles2_interface_stub.h" |
11 #include "media/base/video_frame.h" | 12 #include "media/base/video_frame.h" |
12 #include "media/renderers/mock_gpu_video_accelerator_factories.h" | 13 #include "media/renderers/mock_gpu_video_accelerator_factories.h" |
13 #include "media/video/gpu_memory_buffer_video_frame_pool.h" | 14 #include "media/video/gpu_memory_buffer_video_frame_pool.h" |
14 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
15 | 16 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 size.width() / 2, // v_stride | 116 size.width() / 2, // v_stride |
116 y_data, // y_data | 117 y_data, // y_data |
117 u_data, // u_data | 118 u_data, // u_data |
118 v_data, // v_data | 119 v_data, // v_data |
119 base::TimeDelta()); // timestamp | 120 base::TimeDelta()); // timestamp |
120 EXPECT_TRUE(video_frame); | 121 EXPECT_TRUE(video_frame); |
121 return video_frame; | 122 return video_frame; |
122 } | 123 } |
123 | 124 |
124 protected: | 125 protected: |
125 scoped_ptr<MockGpuVideoAcceleratorFactories> mock_gpu_factories_; | 126 std::unique_ptr<MockGpuVideoAcceleratorFactories> mock_gpu_factories_; |
126 scoped_ptr<GpuMemoryBufferVideoFramePool> gpu_memory_buffer_pool_; | 127 std::unique_ptr<GpuMemoryBufferVideoFramePool> gpu_memory_buffer_pool_; |
127 scoped_refptr<base::TestSimpleTaskRunner> media_task_runner_; | 128 scoped_refptr<base::TestSimpleTaskRunner> media_task_runner_; |
128 scoped_refptr<base::TestSimpleTaskRunner> copy_task_runner_; | 129 scoped_refptr<base::TestSimpleTaskRunner> copy_task_runner_; |
129 // GpuMemoryBufferVideoFramePool uses BindToCurrentLoop(), which requires | 130 // GpuMemoryBufferVideoFramePool uses BindToCurrentLoop(), which requires |
130 // ThreadTaskRunnerHandle initialization. | 131 // ThreadTaskRunnerHandle initialization. |
131 scoped_ptr<base::ThreadTaskRunnerHandle> media_task_runner_handle_; | 132 std::unique_ptr<base::ThreadTaskRunnerHandle> media_task_runner_handle_; |
132 scoped_ptr<TestGLES2Interface> gles2_; | 133 std::unique_ptr<TestGLES2Interface> gles2_; |
133 }; | 134 }; |
134 | 135 |
135 void MaybeCreateHardwareFrameCallback( | 136 void MaybeCreateHardwareFrameCallback( |
136 scoped_refptr<VideoFrame>* video_frame_output, | 137 scoped_refptr<VideoFrame>* video_frame_output, |
137 const scoped_refptr<VideoFrame>& video_frame) { | 138 const scoped_refptr<VideoFrame>& video_frame) { |
138 *video_frame_output = video_frame; | 139 *video_frame_output = video_frame; |
139 } | 140 } |
140 | 141 |
141 TEST_F(GpuMemoryBufferVideoFramePoolTest, VideoFrameOutputFormatUnknown) { | 142 TEST_F(GpuMemoryBufferVideoFramePoolTest, VideoFrameOutputFormatUnknown) { |
142 scoped_refptr<VideoFrame> software_frame = CreateTestYUVVideoFrame(10); | 143 scoped_refptr<VideoFrame> software_frame = CreateTestYUVVideoFrame(10); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 gpu_memory_buffer_pool_->MaybeCreateHardwareFrame( | 304 gpu_memory_buffer_pool_->MaybeCreateHardwareFrame( |
304 software_frame, base::Bind(MaybeCreateHardwareFrameCallback, &frame)); | 305 software_frame, base::Bind(MaybeCreateHardwareFrameCallback, &frame)); |
305 | 306 |
306 RunUntilIdle(); | 307 RunUntilIdle(); |
307 | 308 |
308 EXPECT_NE(software_frame.get(), frame.get()); | 309 EXPECT_NE(software_frame.get(), frame.get()); |
309 EXPECT_EQ(3u, gles2_->gen_textures); | 310 EXPECT_EQ(3u, gles2_->gen_textures); |
310 } | 311 } |
311 | 312 |
312 } // namespace media | 313 } // namespace media |
OLD | NEW |