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

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

Issue 1548443002: Introducing gpu::CommandBufferId as a distinct, IdType<...>-based type. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@type-safe-save-package-id-self-contained
Patch Set: Created 4 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
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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 } 267 }
268 268
269 static void TextureCallback(gpu::SyncToken* called_sync_token, 269 static void TextureCallback(gpu::SyncToken* called_sync_token,
270 const gpu::SyncToken& release_sync_token) { 270 const gpu::SyncToken& release_sync_token) {
271 *called_sync_token = release_sync_token; 271 *called_sync_token = release_sync_token;
272 } 272 }
273 273
274 // Verify the gpu::MailboxHolder::ReleaseCallback is called when VideoFrame is 274 // Verify the gpu::MailboxHolder::ReleaseCallback is called when VideoFrame is
275 // destroyed with the default release sync point. 275 // destroyed with the default release sync point.
276 TEST(VideoFrame, TextureNoLongerNeededCallbackIsCalled) { 276 TEST(VideoFrame, TextureNoLongerNeededCallbackIsCalled) {
277 gpu::SyncToken called_sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, 1, 277 gpu::SyncToken called_sync_token(gpu::CommandBufferNamespace::GPU_IO, 0,
278 1); 278 gpu::CommandBufferId::FromUnsafeValue(1), 1);
279 279
280 { 280 {
281 scoped_refptr<VideoFrame> frame = VideoFrame::WrapNativeTexture( 281 scoped_refptr<VideoFrame> frame = VideoFrame::WrapNativeTexture(
282 PIXEL_FORMAT_ARGB, 282 PIXEL_FORMAT_ARGB,
283 gpu::MailboxHolder(gpu::Mailbox::Generate(), gpu::SyncToken(), 5), 283 gpu::MailboxHolder(gpu::Mailbox::Generate(), gpu::SyncToken(), 5),
284 base::Bind(&TextureCallback, &called_sync_token), 284 base::Bind(&TextureCallback, &called_sync_token),
285 gfx::Size(10, 10), // coded_size 285 gfx::Size(10, 10), // coded_size
286 gfx::Rect(10, 10), // visible_rect 286 gfx::Rect(10, 10), // visible_rect
287 gfx::Size(10, 10), // natural_size 287 gfx::Size(10, 10), // natural_size
288 base::TimeDelta()); // timestamp 288 base::TimeDelta()); // timestamp
(...skipping 25 matching lines...) Expand all
314 } // namespace 314 } // namespace
315 315
316 // Verify the gpu::MailboxHolder::ReleaseCallback is called when VideoFrame is 316 // Verify the gpu::MailboxHolder::ReleaseCallback is called when VideoFrame is
317 // destroyed with the release sync point, which was updated by clients. 317 // destroyed with the release sync point, which was updated by clients.
318 // (i.e. the compositor, webgl). 318 // (i.e. the compositor, webgl).
319 TEST(VideoFrame, 319 TEST(VideoFrame,
320 TexturesNoLongerNeededCallbackAfterTakingAndReleasingMailboxes) { 320 TexturesNoLongerNeededCallbackAfterTakingAndReleasingMailboxes) {
321 const int kPlanesNum = 3; 321 const int kPlanesNum = 3;
322 const gpu::CommandBufferNamespace kNamespace = 322 const gpu::CommandBufferNamespace kNamespace =
323 gpu::CommandBufferNamespace::GPU_IO; 323 gpu::CommandBufferNamespace::GPU_IO;
324 const uint64_t kCommandBufferId = 0x123; 324 const gpu::CommandBufferId kCommandBufferId =
325 gpu::CommandBufferId::FromUnsafeValue(0x123);
325 gpu::Mailbox mailbox[kPlanesNum]; 326 gpu::Mailbox mailbox[kPlanesNum];
326 for (int i = 0; i < kPlanesNum; ++i) { 327 for (int i = 0; i < kPlanesNum; ++i) {
327 mailbox[i].name[0] = 50 + 1; 328 mailbox[i].name[0] = 50 + 1;
328 } 329 }
329 330
330 gpu::SyncToken sync_token(kNamespace, 0, kCommandBufferId, 7); 331 gpu::SyncToken sync_token(kNamespace, 0, kCommandBufferId, 7);
331 sync_token.SetVerifyFlush(); 332 sync_token.SetVerifyFlush();
332 uint32_t target = 9; 333 uint32_t target = 9;
333 gpu::SyncToken release_sync_token(kNamespace, 0, kCommandBufferId, 111); 334 gpu::SyncToken release_sync_token(kNamespace, 0, kCommandBufferId, 111);
334 release_sync_token.SetVerifyFlush(); 335 release_sync_token.SetVerifyFlush();
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 489
489 for (int i = 0; i < VideoFrameMetadata::NUM_KEYS; ++i) { 490 for (int i = 0; i < VideoFrameMetadata::NUM_KEYS; ++i) {
490 const VideoFrameMetadata::Key key = static_cast<VideoFrameMetadata::Key>(i); 491 const VideoFrameMetadata::Key key = static_cast<VideoFrameMetadata::Key>(i);
491 int value = -1; 492 int value = -1;
492 EXPECT_TRUE(result.GetInteger(key, &value)); 493 EXPECT_TRUE(result.GetInteger(key, &value));
493 EXPECT_EQ(i, value); 494 EXPECT_EQ(i, value);
494 } 495 }
495 } 496 }
496 497
497 } // namespace media 498 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698