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

Side by Side Diff: cc/resources/video_resource_updater_unittest.cc

Issue 1960563002: Add media::VideoFrame::WrapNativeTextures() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | « cc/layers/video_layer_impl_unittest.cc ('k') | cc/trees/layer_tree_host_unittest_context.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "cc/resources/video_resource_updater.h" 5 #include "cc/resources/video_resource_updater.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 unsigned target) { 179 unsigned target) {
180 const int kDimension = 10; 180 const int kDimension = 10;
181 gfx::Size size(kDimension, kDimension); 181 gfx::Size size(kDimension, kDimension);
182 182
183 gpu::Mailbox mailbox; 183 gpu::Mailbox mailbox;
184 mailbox.name[0] = 51; 184 mailbox.name[0] = 51;
185 185
186 const gpu::SyncToken sync_token( 186 const gpu::SyncToken sync_token(
187 gpu::CommandBufferNamespace::GPU_IO, 0, 187 gpu::CommandBufferNamespace::GPU_IO, 0,
188 gpu::CommandBufferId::FromUnsafeValue(0x123), 7); 188 gpu::CommandBufferId::FromUnsafeValue(0x123), 7);
189 gpu::MailboxHolder mailbox_holders[media::VideoFrame::kMaxPlanes] = {
190 gpu::MailboxHolder(mailbox, sync_token, target)};
189 scoped_refptr<media::VideoFrame> video_frame = 191 scoped_refptr<media::VideoFrame> video_frame =
190 media::VideoFrame::WrapNativeTexture( 192 media::VideoFrame::WrapNativeTextures(media::PIXEL_FORMAT_ARGB,
191 media::PIXEL_FORMAT_ARGB, 193 mailbox_holders,
192 gpu::MailboxHolder(mailbox, sync_token, target), 194 base::Bind(&ReleaseMailboxCB),
193 base::Bind(&ReleaseMailboxCB), 195 size, // coded_size
194 size, // coded_size 196 gfx::Rect(size), // visible_rect
195 gfx::Rect(size), // visible_rect 197 size, // natural_size
196 size, // natural_size 198 base::TimeDelta()); // timestamp
197 base::TimeDelta()); // timestamp
198 EXPECT_TRUE(video_frame); 199 EXPECT_TRUE(video_frame);
199 return video_frame; 200 return video_frame;
200 } 201 }
201 202
202 scoped_refptr<media::VideoFrame> CreateTestRGBAHardwareVideoFrame() { 203 scoped_refptr<media::VideoFrame> CreateTestRGBAHardwareVideoFrame() {
203 return CreateTestHardwareVideoFrame(GL_TEXTURE_2D); 204 return CreateTestHardwareVideoFrame(GL_TEXTURE_2D);
204 } 205 }
205 206
206 scoped_refptr<media::VideoFrame> CreateTestStreamTextureHardwareVideoFrame( 207 scoped_refptr<media::VideoFrame> CreateTestStreamTextureHardwareVideoFrame(
207 bool needs_copy) { 208 bool needs_copy) {
208 scoped_refptr<media::VideoFrame> video_frame = 209 scoped_refptr<media::VideoFrame> video_frame =
209 CreateTestHardwareVideoFrame(GL_TEXTURE_EXTERNAL_OES); 210 CreateTestHardwareVideoFrame(GL_TEXTURE_EXTERNAL_OES);
210 video_frame->metadata()->SetBoolean( 211 video_frame->metadata()->SetBoolean(
211 media::VideoFrameMetadata::COPY_REQUIRED, needs_copy); 212 media::VideoFrameMetadata::COPY_REQUIRED, needs_copy);
212 return video_frame; 213 return video_frame;
213 } 214 }
214 215
215 scoped_refptr<media::VideoFrame> CreateTestYuvHardwareVideoFrame() { 216 scoped_refptr<media::VideoFrame> CreateTestYuvHardwareVideoFrame() {
216 const int kDimension = 10; 217 const int kDimension = 10;
217 gfx::Size size(kDimension, kDimension); 218 gfx::Size size(kDimension, kDimension);
218 219
219 const int kPlanesNum = 3;
220 gpu::Mailbox mailbox[kPlanesNum];
221 for (int i = 0; i < kPlanesNum; ++i) {
222 mailbox[i].name[0] = 50 + 1;
223 }
224 const gpu::SyncToken sync_token( 220 const gpu::SyncToken sync_token(
225 gpu::CommandBufferNamespace::GPU_IO, 0, 221 gpu::CommandBufferNamespace::GPU_IO, 0,
226 gpu::CommandBufferId::FromUnsafeValue(0x123), 7); 222 gpu::CommandBufferId::FromUnsafeValue(0x123), 7);
227 const unsigned target = GL_TEXTURE_RECTANGLE_ARB; 223 const unsigned target = GL_TEXTURE_RECTANGLE_ARB;
224 const int kPlanesNum = 3;
225 gpu::MailboxHolder mailbox_holders[media::VideoFrame::kMaxPlanes];
226 for (int i = 0; i < kPlanesNum; ++i) {
227 gpu::Mailbox mailbox;
228 mailbox.name[0] = 50 + 1;
229 mailbox_holders[i] = gpu::MailboxHolder(mailbox, sync_token, target);
230 }
228 scoped_refptr<media::VideoFrame> video_frame = 231 scoped_refptr<media::VideoFrame> video_frame =
229 media::VideoFrame::WrapYUV420NativeTextures( 232 media::VideoFrame::WrapNativeTextures(media::PIXEL_FORMAT_I420,
230 gpu::MailboxHolder(mailbox[media::VideoFrame::kYPlane], sync_token, 233 mailbox_holders,
231 target), 234 base::Bind(&ReleaseMailboxCB),
232 gpu::MailboxHolder(mailbox[media::VideoFrame::kUPlane], sync_token, 235 size, // coded_size
233 target), 236 gfx::Rect(size), // visible_rect
234 gpu::MailboxHolder(mailbox[media::VideoFrame::kVPlane], sync_token, 237 size, // natural_size
235 target), 238 base::TimeDelta()); // timestamp
236 base::Bind(&ReleaseMailboxCB),
237 size, // coded_size
238 gfx::Rect(size), // visible_rect
239 size, // natural_size
240 base::TimeDelta()); // timestamp
241 EXPECT_TRUE(video_frame); 239 EXPECT_TRUE(video_frame);
242 return video_frame; 240 return video_frame;
243 } 241 }
244 242
245 WebGraphicsContext3DUploadCounter* context3d_; 243 WebGraphicsContext3DUploadCounter* context3d_;
246 FakeOutputSurfaceClient client_; 244 FakeOutputSurfaceClient client_;
247 std::unique_ptr<FakeOutputSurface> output_surface3d_; 245 std::unique_ptr<FakeOutputSurface> output_surface3d_;
248 std::unique_ptr<FakeOutputSurface> output_surface_software_; 246 std::unique_ptr<FakeOutputSurface> output_surface_software_;
249 std::unique_ptr<SharedBitmapManagerAllocationCounter> shared_bitmap_manager_; 247 std::unique_ptr<SharedBitmapManagerAllocationCounter> shared_bitmap_manager_;
250 std::unique_ptr<ResourceProvider> resource_provider3d_; 248 std::unique_ptr<ResourceProvider> resource_provider3d_;
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 // The texture copy path requires the use of CopyTextureCHROMIUM, which 505 // The texture copy path requires the use of CopyTextureCHROMIUM, which
508 // enforces that the target texture not be immutable, as it may need 506 // enforces that the target texture not be immutable, as it may need
509 // to alter the storage of the texture. Therefore, this test asserts 507 // to alter the storage of the texture. Therefore, this test asserts
510 // that an immutable texture wasn't created by glTexStorage2DEXT, when 508 // that an immutable texture wasn't created by glTexStorage2DEXT, when
511 // that extension is supported. 509 // that extension is supported.
512 EXPECT_FALSE(context3d_->WasImmutableTextureCreated()); 510 EXPECT_FALSE(context3d_->WasImmutableTextureCreated());
513 } 511 }
514 512
515 } // namespace 513 } // namespace
516 } // namespace cc 514 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/video_layer_impl_unittest.cc ('k') | cc/trees/layer_tree_host_unittest_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698