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

Unified Diff: media/base/video_frame_unittest.cc

Issue 1117423002: media: Let VideoFrame carry more than one native texture. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address reveman's comments. Created 5 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 side-by-side diff with in-line comments
Download patch
Index: media/base/video_frame_unittest.cc
diff --git a/media/base/video_frame_unittest.cc b/media/base/video_frame_unittest.cc
index 5c2159f65f73a4f7d3bd7b271cadd8f4981f1952..e8ed4107bf0cb5730b5e249be94fb5a17cd9240a 100644
--- a/media/base/video_frame_unittest.cc
+++ b/media/base/video_frame_unittest.cc
@@ -252,14 +252,14 @@ TEST(VideoFrame, TextureNoLongerNeededCallbackIsCalled) {
{
scoped_refptr<VideoFrame> frame = VideoFrame::WrapNativeTexture(
- make_scoped_ptr(
- new gpu::MailboxHolder(gpu::Mailbox(), 5, 0 /* sync_point */)),
+ gpu::MailboxHolder(gpu::Mailbox(), 5, 0 /* sync_point */),
base::Bind(&TextureCallback, &called_sync_point),
- gfx::Size(10, 10), // coded_size
- gfx::Rect(10, 10), // visible_rect
- gfx::Size(10, 10), // natural_size
- base::TimeDelta(), // timestamp
- false); // allow_overlay
+ gfx::Size(10, 10), // coded_size
+ gfx::Rect(10, 10), // visible_rect
+ gfx::Size(10, 10), // natural_size
+ base::TimeDelta(), // timestamp
+ false); // allow_overlay
+ EXPECT_EQ(VideoFrame::TEXTURE_RGBA, frame->texture_format());
}
// Nobody set a sync point to |frame|, so |frame| set |called_sync_point| to 0
// as default value.
@@ -284,33 +284,44 @@ class SyncPointClientImpl : public VideoFrame::SyncPointClient {
// Verify the gpu::MailboxHolder::ReleaseCallback is called when VideoFrame is
// destroyed with the release sync point, which was updated by clients.
// (i.e. the compositor, webgl).
-TEST(VideoFrame, TextureNoLongerNeededCallbackAfterTakingAndReleasingMailbox) {
- gpu::Mailbox mailbox;
- mailbox.name[0] = 50;
+TEST(VideoFrame,
+ TexturesNoLongerNeededCallbackAfterTakingAndReleasingMailboxes) {
+ const int kPlanesNum = 3;
+ gpu::Mailbox mailbox[kPlanesNum];
+ for (int i = 0; i < kPlanesNum; ++i) {
+ mailbox[i].name[0] = 50 + 1;
+ }
+
uint32 sync_point = 7;
uint32 target = 9;
uint32 release_sync_point = 111;
uint32 called_sync_point = 0;
-
{
- scoped_refptr<VideoFrame> frame = VideoFrame::WrapNativeTexture(
- make_scoped_ptr(new gpu::MailboxHolder(mailbox, target, sync_point)),
+ scoped_refptr<VideoFrame> frame = VideoFrame::WrapYUV420NativeTextures(
+ gpu::MailboxHolder(mailbox[VideoFrame::kYPlane], target, sync_point),
+ gpu::MailboxHolder(mailbox[VideoFrame::kUPlane], target, sync_point),
+ gpu::MailboxHolder(mailbox[VideoFrame::kVPlane], target, sync_point),
base::Bind(&TextureCallback, &called_sync_point),
- gfx::Size(10, 10), // coded_size
- gfx::Rect(10, 10), // visible_rect
- gfx::Size(10, 10), // natural_size
- base::TimeDelta(), // timestamp
- false); // allow_overlay
-
- const gpu::MailboxHolder* mailbox_holder = frame->mailbox_holder();
-
- EXPECT_EQ(mailbox.name[0], mailbox_holder->mailbox.name[0]);
- EXPECT_EQ(target, mailbox_holder->texture_target);
- EXPECT_EQ(sync_point, mailbox_holder->sync_point);
+ gfx::Size(10, 10), // coded_size
+ gfx::Rect(10, 10), // visible_rect
+ gfx::Size(10, 10), // natural_size
+ base::TimeDelta(), // timestamp
+ false); // allow_overlay
+
+ EXPECT_EQ(VideoFrame::TEXTURE_YUV_420, frame->texture_format());
+ EXPECT_EQ(3u, VideoFrame::NumTextures(frame->texture_format()));
+ for (size_t i = 0; i < VideoFrame::NumTextures(frame->texture_format());
+ ++i) {
+ const gpu::MailboxHolder& mailbox_holder = frame->mailbox_holder(i);
+ EXPECT_EQ(mailbox[i].name[0], mailbox_holder.mailbox.name[0]);
+ EXPECT_EQ(target, mailbox_holder.texture_target);
+ EXPECT_EQ(sync_point, mailbox_holder.sync_point);
+ }
SyncPointClientImpl client(release_sync_point);
frame->UpdateReleaseSyncPoint(&client);
- EXPECT_EQ(sync_point, mailbox_holder->sync_point);
+ EXPECT_EQ(sync_point,
+ frame->mailbox_holder(VideoFrame::kYPlane).sync_point);
}
EXPECT_EQ(release_sync_point, called_sync_point);
}

Powered by Google App Engine
This is Rietveld 408576698