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

Unified Diff: content/browser/renderer_host/media/video_capture_controller_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: previous patchset has unrelated code by mistake. Created 6 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/media/video_capture_controller_unittest.cc
diff --git a/content/browser/renderer_host/media/video_capture_controller_unittest.cc b/content/browser/renderer_host/media/video_capture_controller_unittest.cc
index 5fbb515af78697037d4c76ad56471e51dbc56710..d21a22d561671bcda19c54a6a450679513ab12f7 100644
--- a/content/browser/renderer_host/media/video_capture_controller_unittest.cc
+++ b/content/browser/renderer_host/media/video_capture_controller_unittest.cc
@@ -70,7 +70,7 @@ class MockVideoCaptureControllerEventHandler
id,
this,
buffer_id,
- 0));
+ std::vector<uint32>()));
}
virtual void OnMailboxBufferReady(const VideoCaptureControllerID& id,
int buffer_id,
@@ -79,7 +79,8 @@ class MockVideoCaptureControllerEventHandler
base::TimeTicks timestamp) OVERRIDE {
DoMailboxBufferReady(id);
// Use a very different syncpoint value when returning a new syncpoint.
- const uint32 new_sync_point = ~mailbox_holder.sync_point;
+ std::vector<uint32> release_sync_points;
+ release_sync_points.push_back(~mailbox_holder.sync_point);
base::MessageLoop::current()->PostTask(
FROM_HERE,
base::Bind(&VideoCaptureController::ReturnBuffer,
@@ -87,7 +88,7 @@ class MockVideoCaptureControllerEventHandler
id,
this,
buffer_id,
- new_sync_point));
+ release_sync_points));
}
virtual void OnEnded(const VideoCaptureControllerID& id) OVERRIDE {
DoEnded(id);
@@ -262,9 +263,13 @@ TEST_F(VideoCaptureControllerTest, AddAndRemoveClients) {
<< "Client count should return to zero after all clients are gone.";
}
-static void CacheSyncPoint(uint32* sync_value,
- scoped_ptr<gpu::MailboxHolder> mailbox_holder) {
- *sync_value = mailbox_holder->sync_point;
+static void CacheSyncPoint(uint32* called_mailbox_sync_point,
+ std::vector<uint32>* called_release_sync_points,
+ scoped_ptr<gpu::MailboxHolder> mailbox_holder,
+ const std::vector<uint32>& release_sync_points) {
+ *called_mailbox_sync_point = mailbox_holder->sync_point;
+ std::vector<uint32> sync_points(release_sync_points);
+ called_release_sync_points->swap(sync_points);
}
// This test will connect and disconnect several clients while simulating an
@@ -482,6 +487,7 @@ TEST_F(VideoCaptureControllerTest, NormalCaptureMultipleClients) {
}
std::vector<uint32> mailbox_syncpoints(mailbox_buffers);
std::vector<uint32> mailbox_syncpoints_new(mailbox_buffers);
+ std::vector<std::vector<uint32> > release_syncpoint_vectors(mailbox_buffers);
for (int i = 0; i < mailbox_buffers; ++i) {
buffer = device_->ReserveOutputBuffer(media::VideoFrame::NATIVE_TEXTURE,
gfx::Size(0, 0));
@@ -492,12 +498,13 @@ TEST_F(VideoCaptureControllerTest, NormalCaptureMultipleClients) {
media::VideoCaptureFormat(capture_resolution,
device_format.frame_rate,
media::PIXEL_FORMAT_TEXTURE),
- WrapMailboxBuffer(
- buffer,
- make_scoped_ptr(new gpu::MailboxHolder(
- gpu::Mailbox(), 0, mailbox_syncpoints[i])),
- base::Bind(&CacheSyncPoint, &mailbox_syncpoints_new[i]),
- capture_resolution),
+ WrapMailboxBuffer(buffer,
+ make_scoped_ptr(new gpu::MailboxHolder(
+ gpu::Mailbox(), 0, mailbox_syncpoints[i])),
+ base::Bind(&CacheSyncPoint,
+ &mailbox_syncpoints_new[i],
+ &release_syncpoint_vectors[i]),
+ capture_resolution),
base::TimeTicks());
buffer = NULL;
}
@@ -512,8 +519,10 @@ TEST_F(VideoCaptureControllerTest, NormalCaptureMultipleClients) {
.Times(mailbox_buffers);
base::RunLoop().RunUntilIdle();
for (size_t i = 0; i < mailbox_syncpoints.size(); ++i) {
+ ASSERT_EQ(mailbox_syncpoints[i], mailbox_syncpoints_new[i]);
// See: MockVideoCaptureControllerEventHandler::OnMailboxBufferReady()
- ASSERT_EQ(mailbox_syncpoints[i], ~mailbox_syncpoints_new[i]);
+ ASSERT_EQ(1u, release_syncpoint_vectors[i].size());
+ ASSERT_EQ(mailbox_syncpoints[i], ~release_syncpoint_vectors[i][0]);
}
Mock::VerifyAndClearExpectations(client_b_.get());
}

Powered by Google App Engine
This is Rietveld 408576698