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

Unified Diff: media/base/video_frame_unittest.cc

Issue 175223003: HW Video: Make media::VideoFrame handle the sync point of the compositor as well as webgl (Closed) Base URL: https://git.chromium.org/chromium/src.git@master
Patch Set: rebase to ToT Created 6 years, 8 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
« no previous file with comments | « media/base/video_frame.cc ('k') | media/filters/gpu_video_decoder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/video_frame_unittest.cc
diff --git a/media/base/video_frame_unittest.cc b/media/base/video_frame_unittest.cc
index 8e7ce8f4a19773a02f0567c1a5ae047967c41563..618d68f458f774de68fc2792e3e6693247308eae 100644
--- a/media/base/video_frame_unittest.cc
+++ b/media/base/video_frame_unittest.cc
@@ -240,63 +240,72 @@ TEST(VideoFrame, CheckFrameExtents) {
ExpectFrameExtents(VideoFrame::YV16, "cce408a044b212db42a10dfec304b3ef");
}
-static void TextureCallback(uint32* called_sync_point,
- scoped_ptr<gpu::MailboxHolder> mailbox_holder) {
- *called_sync_point = mailbox_holder->sync_point;
+static void TextureCallback(std::vector<uint32>* called_sync_point,
+ const std::vector<uint32>& release_sync_points) {
+ called_sync_point->assign(release_sync_points.begin(),
+ release_sync_points.end());
}
// Verify the gpu::MailboxHolder::ReleaseCallback is called when VideoFrame is
-// destroyed with the original sync point.
+// destroyed with the default release sync points.
TEST(VideoFrame, TextureNoLongerNeededCallbackIsCalled) {
- uint32 sync_point = 7;
- uint32 called_sync_point = 0;
+ std::vector<uint32> called_sync_points;
+ called_sync_points.push_back(1);
{
scoped_refptr<VideoFrame> frame = VideoFrame::WrapNativeTexture(
- make_scoped_ptr(new gpu::MailboxHolder(gpu::Mailbox(), 5, 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
- base::Callback<void(const SkBitmap&)>()); // read_pixels_cb
-
- EXPECT_EQ(0u, called_sync_point);
+ make_scoped_ptr(
+ new gpu::MailboxHolder(gpu::Mailbox(), 5, 0 /* sync_point */)),
+ base::Bind(&TextureCallback, &called_sync_points),
+ gfx::Size(10, 10), // coded_size
+ gfx::Rect(10, 10), // visible_rect
+ gfx::Size(10, 10), // natural_size
+ base::TimeDelta(), // timestamp
+ VideoFrame::ReadPixelsCB()); // read_pixels_cb
+
+ EXPECT_EQ(1u, called_sync_points.size());
}
- EXPECT_EQ(sync_point, called_sync_point);
+ EXPECT_TRUE(called_sync_points.empty());
}
// Verify the gpu::MailboxHolder::ReleaseCallback is called when VideoFrame is
-// destroyed with the new sync point, when the mailbox is accessed by a caller.
+// destroyed with the release sync points, which was updated by clients.
+// (i.e. the compositor, webgl).
TEST(VideoFrame, TextureNoLongerNeededCallbackAfterTakingAndReleasingMailbox) {
- uint32 called_sync_point = 0;
+ std::vector<uint32> called_sync_points;
gpu::Mailbox mailbox;
mailbox.name[0] = 50;
uint32 sync_point = 7;
uint32 target = 9;
+ std::vector<uint32> release_sync_points;
+ release_sync_points.push_back(1);
+ release_sync_points.push_back(2);
+ release_sync_points.push_back(3);
{
scoped_refptr<VideoFrame> frame = VideoFrame::WrapNativeTexture(
make_scoped_ptr(new gpu::MailboxHolder(mailbox, 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
- base::Callback<void(const SkBitmap&)>()); // read_pixels_cb
+ base::Bind(&TextureCallback, &called_sync_points),
+ gfx::Size(10, 10), // coded_size
+ gfx::Rect(10, 10), // visible_rect
+ gfx::Size(10, 10), // natural_size
+ base::TimeDelta(), // timestamp
+ VideoFrame::ReadPixelsCB()); // read_pixels_cb
+ EXPECT_TRUE(called_sync_points.empty());
- gpu::MailboxHolder* mailbox_holder = frame->mailbox_holder();
+ 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);
- // Finish using the mailbox_holder and drop our reference.
- sync_point = 10;
- mailbox_holder->sync_point = sync_point;
+ frame->AppendReleaseSyncPoint(release_sync_points[0]);
+ frame->AppendReleaseSyncPoint(release_sync_points[1]);
+ frame->AppendReleaseSyncPoint(release_sync_points[2]);
+ EXPECT_EQ(sync_point, mailbox_holder->sync_point);
}
- EXPECT_EQ(sync_point, called_sync_point);
+ EXPECT_EQ(release_sync_points, called_sync_points);
}
} // namespace media
« no previous file with comments | « media/base/video_frame.cc ('k') | media/filters/gpu_video_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698