Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(516)

Side by Side Diff: media/video/gpu_memory_buffer_video_frame_pool_unittest.cc

Issue 2648633005: cros: Support YUYV format for GPU memory buffer video frames
Patch Set: Enable YUYV GPU memory buffer video frames Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/video/gpu_memory_buffer_video_frame_pool.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include <memory>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/test/test_simple_task_runner.h" 9 #include "base/test/test_simple_task_runner.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 software_frame, base::Bind(MaybeCreateHardwareFrameCallback, &frame)); 225 software_frame, base::Bind(MaybeCreateHardwareFrameCallback, &frame));
226 226
227 RunUntilIdle(); 227 RunUntilIdle();
228 228
229 EXPECT_NE(software_frame.get(), frame.get()); 229 EXPECT_NE(software_frame.get(), frame.get());
230 EXPECT_EQ(1u, gles2_->gen_textures); 230 EXPECT_EQ(1u, gles2_->gen_textures);
231 EXPECT_TRUE(frame->metadata()->IsTrue( 231 EXPECT_TRUE(frame->metadata()->IsTrue(
232 media::VideoFrameMetadata::READ_LOCK_FENCES_ENABLED)); 232 media::VideoFrameMetadata::READ_LOCK_FENCES_ENABLED));
233 } 233 }
234 234
235 TEST_F(GpuMemoryBufferVideoFramePoolTest, CreateOneHardwareYUYVFrame) {
236 scoped_refptr<VideoFrame> software_frame = CreateTestYUVVideoFrame(10);
237 scoped_refptr<VideoFrame> frame;
238 mock_gpu_factories_->SetVideoFrameOutputFormat(
239 media::GpuVideoAcceleratorFactories::OutputFormat::YUYV);
240 gpu_memory_buffer_pool_->MaybeCreateHardwareFrame(
241 software_frame, base::Bind(MaybeCreateHardwareFrameCallback, &frame));
242
243 RunUntilIdle();
244
245 EXPECT_NE(software_frame.get(), frame.get());
246 EXPECT_EQ(1u, gles2_->gen_textures);
247 EXPECT_TRUE(frame->metadata()->IsTrue(
248 media::VideoFrameMetadata::READ_LOCK_FENCES_ENABLED));
249 }
250
235 TEST_F(GpuMemoryBufferVideoFramePoolTest, CreateOneHardwareNV12Frame) { 251 TEST_F(GpuMemoryBufferVideoFramePoolTest, CreateOneHardwareNV12Frame) {
236 scoped_refptr<VideoFrame> software_frame = CreateTestYUVVideoFrame(10); 252 scoped_refptr<VideoFrame> software_frame = CreateTestYUVVideoFrame(10);
237 scoped_refptr<VideoFrame> frame; 253 scoped_refptr<VideoFrame> frame;
238 mock_gpu_factories_->SetVideoFrameOutputFormat( 254 mock_gpu_factories_->SetVideoFrameOutputFormat(
239 media::GpuVideoAcceleratorFactories::OutputFormat::NV12_SINGLE_GMB); 255 media::GpuVideoAcceleratorFactories::OutputFormat::NV12_SINGLE_GMB);
240 gpu_memory_buffer_pool_->MaybeCreateHardwareFrame( 256 gpu_memory_buffer_pool_->MaybeCreateHardwareFrame(
241 software_frame, base::Bind(MaybeCreateHardwareFrameCallback, &frame)); 257 software_frame, base::Bind(MaybeCreateHardwareFrameCallback, &frame));
242 258
243 RunUntilIdle(); 259 RunUntilIdle();
244 260
(...skipping 29 matching lines...) Expand all
274 gpu_memory_buffer_pool_->MaybeCreateHardwareFrame( 290 gpu_memory_buffer_pool_->MaybeCreateHardwareFrame(
275 software_frame, base::Bind(MaybeCreateHardwareFrameCallback, &frame)); 291 software_frame, base::Bind(MaybeCreateHardwareFrameCallback, &frame));
276 292
277 RunUntilIdle(); 293 RunUntilIdle();
278 294
279 EXPECT_NE(software_frame.get(), frame.get()); 295 EXPECT_NE(software_frame.get(), frame.get());
280 EXPECT_EQ(3u, gles2_->gen_textures); 296 EXPECT_EQ(3u, gles2_->gen_textures);
281 } 297 }
282 298
283 } // namespace media 299 } // namespace media
OLDNEW
« no previous file with comments | « media/video/gpu_memory_buffer_video_frame_pool.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698