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

Unified Diff: content/browser/renderer_host/media/video_capture_controller.cc

Issue 2410383002: VideoCapture: more migration IPC-->mojo, part 6 (Closed)
Patch Set: Comment correction Created 4 years, 2 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.cc
diff --git a/content/browser/renderer_host/media/video_capture_controller.cc b/content/browser/renderer_host/media/video_capture_controller.cc
index 85f0a2948c7586ce94c82b43916f65668e3426d9..4455c94f01c931ac96272eef71e3b2358be71304 100644
--- a/content/browser/renderer_host/media/video_capture_controller.cc
+++ b/content/browser/renderer_host/media/video_capture_controller.cc
@@ -129,12 +129,10 @@ class VideoFrameReceiverOnIOThread : public media::VideoFrameReceiver {
struct VideoCaptureController::ControllerClient {
ControllerClient(VideoCaptureControllerID id,
VideoCaptureControllerEventHandler* handler,
- base::ProcessHandle render_process,
media::VideoCaptureSessionId session_id,
const media::VideoCaptureParams& params)
: controller_id(id),
event_handler(handler),
- render_process_handle(render_process),
session_id(session_id),
parameters(params),
session_closed(false),
@@ -146,8 +144,6 @@ struct VideoCaptureController::ControllerClient {
const VideoCaptureControllerID controller_id;
VideoCaptureControllerEventHandler* const event_handler;
- // Handle to the render process that will receive the capture buffers.
- const base::ProcessHandle render_process_handle;
const media::VideoCaptureSessionId session_id;
const media::VideoCaptureParams parameters;
@@ -206,7 +202,6 @@ VideoCaptureController::NewDeviceClient() {
void VideoCaptureController::AddClient(
VideoCaptureControllerID id,
VideoCaptureControllerEventHandler* event_handler,
- base::ProcessHandle render_process,
media::VideoCaptureSessionId session_id,
const media::VideoCaptureParams& params) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
@@ -242,8 +237,8 @@ void VideoCaptureController::AddClient(
if (FindClient(id, event_handler, controller_clients_))
return;
- std::unique_ptr<ControllerClient> client = base::MakeUnique<ControllerClient>(
- id, event_handler, render_process, session_id, params);
+ std::unique_ptr<ControllerClient> client =
+ base::MakeUnique<ControllerClient>(id, event_handler, session_id, params);
// If we already have gotten frame_info from the device, repeat it to the new
// client.
if (state_ == VIDEO_CAPTURE_STATE_STARTED) {
@@ -508,14 +503,13 @@ void VideoCaptureController::DoNewBufferOnIOThread(
media::VideoCaptureDevice::Client::Buffer* buffer,
const scoped_refptr<media::VideoFrame>& frame) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
- const int buffer_id = buffer->id();
-
DCHECK_EQ(media::VideoFrame::STORAGE_SHMEM, frame->storage_type());
- base::SharedMemoryHandle remote_handle;
- buffer_pool_->ShareToProcess(buffer_id, client->render_process_handle,
- &remote_handle);
- client->event_handler->OnBufferCreated(client->controller_id, remote_handle,
+ const int buffer_id = buffer->id();
+ mojo::ScopedSharedBufferHandle handle =
+ buffer_pool_->GetHandleForTransit(buffer_id);
+ client->event_handler->OnBufferCreated(client->controller_id,
+ std::move(handle),
buffer->mapped_size(), buffer_id);
}

Powered by Google App Engine
This is Rietveld 408576698