| 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
|
|
|