diff options
Diffstat (limited to 'content/browser')
6 files changed, 31 insertions, 21 deletions
diff --git a/content/browser/renderer_host/media/video_capture_controller.cc b/content/browser/renderer_host/media/video_capture_controller.cc index fb1ff7a..9c70806 100644 --- a/content/browser/renderer_host/media/video_capture_controller.cc +++ b/content/browser/renderer_host/media/video_capture_controller.cc @@ -251,7 +251,7 @@ void VideoCaptureController::ReturnBuffer( const VideoCaptureControllerID& id, VideoCaptureControllerEventHandler* event_handler, int buffer_id, - uint32 sync_point) { + const std::vector<uint32>& sync_points) { DCHECK_CURRENTLY_ON(BrowserThread::IO); ControllerClient* client = FindClient(id, event_handler, controller_clients_); @@ -267,8 +267,10 @@ void VideoCaptureController::ReturnBuffer( scoped_refptr<media::VideoFrame> frame = iter->second; client->active_buffers.erase(iter); - if (frame->format() == media::VideoFrame::NATIVE_TEXTURE) - frame->mailbox_holder()->sync_point = sync_point; + if (frame->format() == media::VideoFrame::NATIVE_TEXTURE) { + for (size_t i = 0; i < sync_points.size(); i++) + frame->AppendReleaseSyncPoint(sync_points[i]); + } buffer_pool_->RelinquishConsumerHold(buffer_id, 1); } diff --git a/content/browser/renderer_host/media/video_capture_controller.h b/content/browser/renderer_host/media/video_capture_controller.h index c0c3bed..9b82870 100644 --- a/content/browser/renderer_host/media/video_capture_controller.h +++ b/content/browser/renderer_host/media/video_capture_controller.h @@ -105,7 +105,7 @@ class CONTENT_EXPORT VideoCaptureController { void ReturnBuffer(const VideoCaptureControllerID& id, VideoCaptureControllerEventHandler* event_handler, int buffer_id, - uint32 sync_point); + const std::vector<uint32>& sync_points); const media::VideoCaptureFormat& GetVideoCaptureFormat() const; 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 5fbb515..f650397 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,11 @@ 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(std::vector<uint32>* called_release_sync_points, + const std::vector<uint32>& release_sync_points) { + DCHECK(called_release_sync_points->empty()); + called_release_sync_points->assign(release_sync_points.begin(), + release_sync_points.end()); } // This test will connect and disconnect several clients while simulating an @@ -481,7 +484,7 @@ TEST_F(VideoCaptureControllerTest, NormalCaptureMultipleClients) { buffer = NULL; } 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)); @@ -496,7 +499,7 @@ TEST_F(VideoCaptureControllerTest, NormalCaptureMultipleClients) { buffer, make_scoped_ptr(new gpu::MailboxHolder( gpu::Mailbox(), 0, mailbox_syncpoints[i])), - base::Bind(&CacheSyncPoint, &mailbox_syncpoints_new[i]), + base::Bind(&CacheSyncPoint, &release_syncpoint_vectors[i]), capture_resolution), base::TimeTicks()); buffer = NULL; @@ -513,7 +516,8 @@ TEST_F(VideoCaptureControllerTest, NormalCaptureMultipleClients) { base::RunLoop().RunUntilIdle(); for (size_t i = 0; i < mailbox_syncpoints.size(); ++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()); } diff --git a/content/browser/renderer_host/media/video_capture_host.cc b/content/browser/renderer_host/media/video_capture_host.cc index 43bc404..14ab5d4 100644 --- a/content/browser/renderer_host/media/video_capture_host.cc +++ b/content/browser/renderer_host/media/video_capture_host.cc @@ -295,9 +295,10 @@ void VideoCaptureHost::OnPauseCapture(int device_id) { Send(new VideoCaptureMsg_StateChanged(device_id, VIDEO_CAPTURE_STATE_ERROR)); } -void VideoCaptureHost::OnReceiveEmptyBuffer(int device_id, - int buffer_id, - uint32 sync_point) { +void VideoCaptureHost::OnReceiveEmptyBuffer( + int device_id, + int buffer_id, + const std::vector<uint32>& sync_points) { DCHECK_CURRENTLY_ON(BrowserThread::IO); VideoCaptureControllerID controller_id(device_id); @@ -305,7 +306,7 @@ void VideoCaptureHost::OnReceiveEmptyBuffer(int device_id, if (it != entries_.end()) { const base::WeakPtr<VideoCaptureController>& controller = it->second; if (controller) - controller->ReturnBuffer(controller_id, this, buffer_id, sync_point); + controller->ReturnBuffer(controller_id, this, buffer_id, sync_points); } } diff --git a/content/browser/renderer_host/media/video_capture_host.h b/content/browser/renderer_host/media/video_capture_host.h index 89dd1d6..25d6947 100644 --- a/content/browser/renderer_host/media/video_capture_host.h +++ b/content/browser/renderer_host/media/video_capture_host.h @@ -125,7 +125,9 @@ class CONTENT_EXPORT VideoCaptureHost // IPC message: Receive an empty buffer from renderer. Send it to device // referenced by |device_id|. - void OnReceiveEmptyBuffer(int device_id, int buffer_id, uint32 sync_point); + void OnReceiveEmptyBuffer(int device_id, + int buffer_id, + const std::vector<uint32>& sync_points); // IPC message: Get supported formats referenced by |capture_session_id|. // |device_id| is needed for message back-routing purposes. diff --git a/content/browser/renderer_host/media/video_capture_host_unittest.cc b/content/browser/renderer_host/media/video_capture_host_unittest.cc index 48a3563..171d300 100644 --- a/content/browser/renderer_host/media/video_capture_host_unittest.cc +++ b/content/browser/renderer_host/media/video_capture_host_unittest.cc @@ -151,7 +151,7 @@ class MockVideoCaptureHost : public VideoCaptureHost { void ReturnReceivedDibs(int device_id) { int handle = GetReceivedDib(); while (handle) { - this->OnReceiveEmptyBuffer(device_id, handle, 0); + this->OnReceiveEmptyBuffer(device_id, handle, std::vector<uint32>()); handle = GetReceivedDib(); } } @@ -239,7 +239,8 @@ class MockVideoCaptureHost : public VideoCaptureHost { OnBufferFilled(device_id, buffer_id, frame_format, timestamp); if (return_buffers_) { - VideoCaptureHost::OnReceiveEmptyBuffer(device_id, buffer_id, 0); + VideoCaptureHost::OnReceiveEmptyBuffer( + device_id, buffer_id, std::vector<uint32>()); } } @@ -252,7 +253,7 @@ class MockVideoCaptureHost : public VideoCaptureHost { device_id, buffer_id, mailbox_holder, format, timestamp); if (return_buffers_) { VideoCaptureHost::OnReceiveEmptyBuffer( - device_id, buffer_id, mailbox_holder.sync_point); + device_id, buffer_id, std::vector<uint32>()); } } |