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

Unified Diff: media/base/video_frame_unittest.cc

Issue 1427543002: Modified old wait sync point functions to also accept new sync tokens. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: format Created 5 years, 1 month 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 879be7dddc3244e1970de5c0c36e593e344f5b9d..c9f05ec6cad3974d3c2669405978dc8c31925a55 100644
--- a/media/base/video_frame_unittest.cc
+++ b/media/base/video_frame_unittest.cc
@@ -261,21 +261,21 @@ TEST(VideoFrame, CheckFrameExtents) {
ExpectFrameExtents(PIXEL_FORMAT_YV16, "cce408a044b212db42a10dfec304b3ef");
}
-static void TextureCallback(uint32* called_sync_point,
- uint32 release_sync_point) {
- *called_sync_point = release_sync_point;
+static void TextureCallback(gpu::SyncToken* called_sync_token,
+ const gpu::SyncToken& release_sync_token) {
+ *called_sync_token = release_sync_token;
}
// Verify the gpu::MailboxHolder::ReleaseCallback is called when VideoFrame is
// destroyed with the default release sync point.
TEST(VideoFrame, TextureNoLongerNeededCallbackIsCalled) {
- uint32 called_sync_point = 1;
+ gpu::SyncToken called_sync_token(1);
{
scoped_refptr<VideoFrame> frame = VideoFrame::WrapNativeTexture(
PIXEL_FORMAT_ARGB,
- gpu::MailboxHolder(gpu::Mailbox::Generate(), 5, 0 /* sync_point */),
- base::Bind(&TextureCallback, &called_sync_point),
+ gpu::MailboxHolder(gpu::Mailbox::Generate(), gpu::SyncToken(), 5),
+ base::Bind(&TextureCallback, &called_sync_token),
gfx::Size(10, 10), // coded_size
gfx::Rect(10, 10), // visible_rect
gfx::Size(10, 10), // natural_size
@@ -284,22 +284,25 @@ TEST(VideoFrame, TextureNoLongerNeededCallbackIsCalled) {
EXPECT_EQ(VideoFrame::STORAGE_OPAQUE, frame->storage_type());
EXPECT_TRUE(frame->HasTextures());
}
- // Nobody set a sync point to |frame|, so |frame| set |called_sync_point| to 0
- // as default value.
- EXPECT_EQ(0u, called_sync_point);
+ // Nobody set a sync point to |frame|, so |frame| set |called_sync_token|
+ // cleared to default value.
+ EXPECT_FALSE(called_sync_token.HasData());
}
namespace {
-class SyncPointClientImpl : public VideoFrame::SyncPointClient {
+class SyncTokenClientImpl : public VideoFrame::SyncTokenClient {
public:
- explicit SyncPointClientImpl(uint32 sync_point) : sync_point_(sync_point) {}
- ~SyncPointClientImpl() override {}
- uint32 InsertSyncPoint() override { return sync_point_; }
- void WaitSyncPoint(uint32 sync_point) override {}
+ explicit SyncTokenClientImpl(const gpu::SyncToken& sync_token)
+ : sync_token_(sync_token) {}
+ ~SyncTokenClientImpl() override {}
+ uint32 InsertSyncPoint() override {
+ return static_cast<uint32>(sync_token_.release_count());
+ }
+ void WaitSyncToken(const gpu::SyncToken& sync_token) override {}
private:
- uint32 sync_point_;
+ gpu::SyncToken sync_token_;
};
} // namespace
@@ -315,20 +318,20 @@ TEST(VideoFrame,
mailbox[i].name[0] = 50 + 1;
}
- uint32 sync_point = 7;
+ gpu::SyncToken sync_token(7);
uint32 target = 9;
- uint32 release_sync_point = 111;
- uint32 called_sync_point = 0;
+ gpu::SyncToken release_sync_token(111);
+ gpu::SyncToken called_sync_token;
{
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
+ gpu::MailboxHolder(mailbox[VideoFrame::kYPlane], sync_token, target),
+ gpu::MailboxHolder(mailbox[VideoFrame::kUPlane], sync_token, target),
+ gpu::MailboxHolder(mailbox[VideoFrame::kVPlane], sync_token, target),
+ base::Bind(&TextureCallback, &called_sync_token),
+ gfx::Size(10, 10), // coded_size
+ gfx::Rect(10, 10), // visible_rect
+ gfx::Size(10, 10), // natural_size
+ base::TimeDelta()); // timestamp
EXPECT_EQ(VideoFrame::STORAGE_OPAQUE, frame->storage_type());
EXPECT_EQ(PIXEL_FORMAT_I420, frame->format());
@@ -338,15 +341,15 @@ TEST(VideoFrame,
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);
+ EXPECT_EQ(sync_token, mailbox_holder.sync_token);
}
- SyncPointClientImpl client(release_sync_point);
- frame->UpdateReleaseSyncPoint(&client);
- EXPECT_EQ(sync_point,
- frame->mailbox_holder(VideoFrame::kYPlane).sync_point);
+ SyncTokenClientImpl client(release_sync_token);
+ frame->UpdateReleaseSyncToken(&client);
+ EXPECT_EQ(sync_token,
+ frame->mailbox_holder(VideoFrame::kYPlane).sync_token);
}
- EXPECT_EQ(release_sync_point, called_sync_point);
+ EXPECT_EQ(release_sync_token, called_sync_token);
}
TEST(VideoFrame, IsValidConfig_OddCodedSize) {
« 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