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

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

Issue 1476523005: Verify returned frames from media::VideoFrame::Wrap*() methods (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 11 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
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 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
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(video_frame.get(), nullptr);
mcasas 2016/01/12 17:46:16 ASSERT_TRUE(video_frame);
emircan 2016/01/14 23:07:40 ASSERT has the same problem as above.
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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 gpu_memory_buffer_pool_->MaybeCreateHardwareFrame( 215 gpu_memory_buffer_pool_->MaybeCreateHardwareFrame(
213 software_frame, base::Bind(MaybeCreateHardwareFrameCallback, &frame)); 216 software_frame, base::Bind(MaybeCreateHardwareFrameCallback, &frame));
214 217
215 RunUntilIdle(); 218 RunUntilIdle();
216 219
217 EXPECT_NE(software_frame.get(), frame.get()); 220 EXPECT_NE(software_frame.get(), frame.get());
218 EXPECT_EQ(3u, gles2_->gen_textures); 221 EXPECT_EQ(3u, gles2_->gen_textures);
219 } 222 }
220 223
221 } // namespace media 224 } // namespace media
OLDNEW
« media/filters/vpx_video_decoder.cc ('K') | « 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