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

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

Issue 1489573003: Added an extra sync token field for extra command buffer identification. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Return False on invalid stream id 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, 1, 1); 272 gpu::SyncToken called_sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, 1,
273 1);
273 274
274 { 275 {
275 scoped_refptr<VideoFrame> frame = VideoFrame::WrapNativeTexture( 276 scoped_refptr<VideoFrame> frame = VideoFrame::WrapNativeTexture(
276 PIXEL_FORMAT_ARGB, 277 PIXEL_FORMAT_ARGB,
277 gpu::MailboxHolder(gpu::Mailbox::Generate(), gpu::SyncToken(), 5), 278 gpu::MailboxHolder(gpu::Mailbox::Generate(), gpu::SyncToken(), 5),
278 base::Bind(&TextureCallback, &called_sync_token), 279 base::Bind(&TextureCallback, &called_sync_token),
279 gfx::Size(10, 10), // coded_size 280 gfx::Size(10, 10), // coded_size
280 gfx::Rect(10, 10), // visible_rect 281 gfx::Rect(10, 10), // visible_rect
281 gfx::Size(10, 10), // natural_size 282 gfx::Size(10, 10), // natural_size
282 base::TimeDelta()); // timestamp 283 base::TimeDelta()); // timestamp
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 TexturesNoLongerNeededCallbackAfterTakingAndReleasingMailboxes) { 315 TexturesNoLongerNeededCallbackAfterTakingAndReleasingMailboxes) {
315 const int kPlanesNum = 3; 316 const int kPlanesNum = 3;
316 const gpu::CommandBufferNamespace kNamespace = 317 const gpu::CommandBufferNamespace kNamespace =
317 gpu::CommandBufferNamespace::GPU_IO; 318 gpu::CommandBufferNamespace::GPU_IO;
318 const uint64_t kCommandBufferId = 0x123; 319 const uint64_t kCommandBufferId = 0x123;
319 gpu::Mailbox mailbox[kPlanesNum]; 320 gpu::Mailbox mailbox[kPlanesNum];
320 for (int i = 0; i < kPlanesNum; ++i) { 321 for (int i = 0; i < kPlanesNum; ++i) {
321 mailbox[i].name[0] = 50 + 1; 322 mailbox[i].name[0] = 50 + 1;
322 } 323 }
323 324
324 gpu::SyncToken sync_token(kNamespace, kCommandBufferId, 7); 325 gpu::SyncToken sync_token(kNamespace, 0, kCommandBufferId, 7);
325 sync_token.SetVerifyFlush(); 326 sync_token.SetVerifyFlush();
326 uint32 target = 9; 327 uint32 target = 9;
327 gpu::SyncToken release_sync_token(kNamespace, kCommandBufferId, 111); 328 gpu::SyncToken release_sync_token(kNamespace, 0, kCommandBufferId, 111);
328 release_sync_token.SetVerifyFlush(); 329 release_sync_token.SetVerifyFlush();
329 330
330 gpu::SyncToken called_sync_token; 331 gpu::SyncToken called_sync_token;
331 { 332 {
332 scoped_refptr<VideoFrame> frame = VideoFrame::WrapYUV420NativeTextures( 333 scoped_refptr<VideoFrame> frame = VideoFrame::WrapYUV420NativeTextures(
333 gpu::MailboxHolder(mailbox[VideoFrame::kYPlane], sync_token, target), 334 gpu::MailboxHolder(mailbox[VideoFrame::kYPlane], sync_token, target),
334 gpu::MailboxHolder(mailbox[VideoFrame::kUPlane], sync_token, target), 335 gpu::MailboxHolder(mailbox[VideoFrame::kUPlane], sync_token, target),
335 gpu::MailboxHolder(mailbox[VideoFrame::kVPlane], sync_token, target), 336 gpu::MailboxHolder(mailbox[VideoFrame::kVPlane], sync_token, target),
336 base::Bind(&TextureCallback, &called_sync_token), 337 base::Bind(&TextureCallback, &called_sync_token),
337 gfx::Size(10, 10), // coded_size 338 gfx::Size(10, 10), // coded_size
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 483
483 for (int i = 0; i < VideoFrameMetadata::NUM_KEYS; ++i) { 484 for (int i = 0; i < VideoFrameMetadata::NUM_KEYS; ++i) {
484 const VideoFrameMetadata::Key key = static_cast<VideoFrameMetadata::Key>(i); 485 const VideoFrameMetadata::Key key = static_cast<VideoFrameMetadata::Key>(i);
485 int value = -1; 486 int value = -1;
486 EXPECT_TRUE(result.GetInteger(key, &value)); 487 EXPECT_TRUE(result.GetInteger(key, &value));
487 EXPECT_EQ(i, value); 488 EXPECT_EQ(i, value);
488 } 489 }
489 } 490 }
490 491
491 } // namespace media 492 } // 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