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

Side by Side Diff: media/base/video_frame_unittest.cc

Issue 1495893005: Revert of Added an extra sync token field for extra command buffer identification. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "media/base/video_frame.h" 5 #include "media/base/video_frame.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/memory/aligned_memory.h" 10 #include "base/memory/aligned_memory.h"
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 } 262 }
263 263
264 static void TextureCallback(gpu::SyncToken* called_sync_token, 264 static void TextureCallback(gpu::SyncToken* called_sync_token,
265 const gpu::SyncToken& release_sync_token) { 265 const gpu::SyncToken& release_sync_token) {
266 *called_sync_token = release_sync_token; 266 *called_sync_token = release_sync_token;
267 } 267 }
268 268
269 // Verify the gpu::MailboxHolder::ReleaseCallback is called when VideoFrame is 269 // Verify the gpu::MailboxHolder::ReleaseCallback is called when VideoFrame is
270 // destroyed with the default release sync point. 270 // destroyed with the default release sync point.
271 TEST(VideoFrame, TextureNoLongerNeededCallbackIsCalled) { 271 TEST(VideoFrame, TextureNoLongerNeededCallbackIsCalled) {
272 gpu::SyncToken called_sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, 1, 272 gpu::SyncToken called_sync_token(gpu::CommandBufferNamespace::GPU_IO, 1, 1);
273 1);
274 273
275 { 274 {
276 scoped_refptr<VideoFrame> frame = VideoFrame::WrapNativeTexture( 275 scoped_refptr<VideoFrame> frame = VideoFrame::WrapNativeTexture(
277 PIXEL_FORMAT_ARGB, 276 PIXEL_FORMAT_ARGB,
278 gpu::MailboxHolder(gpu::Mailbox::Generate(), gpu::SyncToken(), 5), 277 gpu::MailboxHolder(gpu::Mailbox::Generate(), gpu::SyncToken(), 5),
279 base::Bind(&TextureCallback, &called_sync_token), 278 base::Bind(&TextureCallback, &called_sync_token),
280 gfx::Size(10, 10), // coded_size 279 gfx::Size(10, 10), // coded_size
281 gfx::Rect(10, 10), // visible_rect 280 gfx::Rect(10, 10), // visible_rect
282 gfx::Size(10, 10), // natural_size 281 gfx::Size(10, 10), // natural_size
283 base::TimeDelta()); // timestamp 282 base::TimeDelta()); // timestamp
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 TexturesNoLongerNeededCallbackAfterTakingAndReleasingMailboxes) { 314 TexturesNoLongerNeededCallbackAfterTakingAndReleasingMailboxes) {
316 const int kPlanesNum = 3; 315 const int kPlanesNum = 3;
317 const gpu::CommandBufferNamespace kNamespace = 316 const gpu::CommandBufferNamespace kNamespace =
318 gpu::CommandBufferNamespace::GPU_IO; 317 gpu::CommandBufferNamespace::GPU_IO;
319 const uint64_t kCommandBufferId = 0x123; 318 const uint64_t kCommandBufferId = 0x123;
320 gpu::Mailbox mailbox[kPlanesNum]; 319 gpu::Mailbox mailbox[kPlanesNum];
321 for (int i = 0; i < kPlanesNum; ++i) { 320 for (int i = 0; i < kPlanesNum; ++i) {
322 mailbox[i].name[0] = 50 + 1; 321 mailbox[i].name[0] = 50 + 1;
323 } 322 }
324 323
325 gpu::SyncToken sync_token(kNamespace, 0, kCommandBufferId, 7); 324 gpu::SyncToken sync_token(kNamespace, kCommandBufferId, 7);
326 sync_token.SetVerifyFlush(); 325 sync_token.SetVerifyFlush();
327 uint32 target = 9; 326 uint32 target = 9;
328 gpu::SyncToken release_sync_token(kNamespace, 0, kCommandBufferId, 111); 327 gpu::SyncToken release_sync_token(kNamespace, kCommandBufferId, 111);
329 release_sync_token.SetVerifyFlush(); 328 release_sync_token.SetVerifyFlush();
330 329
331 gpu::SyncToken called_sync_token; 330 gpu::SyncToken called_sync_token;
332 { 331 {
333 scoped_refptr<VideoFrame> frame = VideoFrame::WrapYUV420NativeTextures( 332 scoped_refptr<VideoFrame> frame = VideoFrame::WrapYUV420NativeTextures(
334 gpu::MailboxHolder(mailbox[VideoFrame::kYPlane], sync_token, target), 333 gpu::MailboxHolder(mailbox[VideoFrame::kYPlane], sync_token, target),
335 gpu::MailboxHolder(mailbox[VideoFrame::kUPlane], sync_token, target), 334 gpu::MailboxHolder(mailbox[VideoFrame::kUPlane], sync_token, target),
336 gpu::MailboxHolder(mailbox[VideoFrame::kVPlane], sync_token, target), 335 gpu::MailboxHolder(mailbox[VideoFrame::kVPlane], sync_token, target),
337 base::Bind(&TextureCallback, &called_sync_token), 336 base::Bind(&TextureCallback, &called_sync_token),
338 gfx::Size(10, 10), // coded_size 337 gfx::Size(10, 10), // coded_size
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 482
484 for (int i = 0; i < VideoFrameMetadata::NUM_KEYS; ++i) { 483 for (int i = 0; i < VideoFrameMetadata::NUM_KEYS; ++i) {
485 const VideoFrameMetadata::Key key = static_cast<VideoFrameMetadata::Key>(i); 484 const VideoFrameMetadata::Key key = static_cast<VideoFrameMetadata::Key>(i);
486 int value = -1; 485 int value = -1;
487 EXPECT_TRUE(result.GetInteger(key, &value)); 486 EXPECT_TRUE(result.GetInteger(key, &value));
488 EXPECT_EQ(i, value); 487 EXPECT_EQ(i, value);
489 } 488 }
490 } 489 }
491 490
492 } // namespace media 491 } // namespace media
OLDNEW
« no previous file with comments | « gpu/ipc/gpu_command_buffer_traits.cc ('k') | mojo/converters/surfaces/surfaces_type_converters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698