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

Side by Side Diff: content/renderer/media/video_capture_impl.cc

Issue 2395163002: VideoCapture: migrate VideoCapture renderer-->host messages to mojo, part 2 (Closed)
Patch Set: Added //content/common:mojo_bindings dep on //services/video_capture/public/interfaces 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // Notes about usage of this object by VideoCaptureImplManager. 5 // Notes about usage of this object by VideoCaptureImplManager.
6 // 6 //
7 // VideoCaptureImplManager access this object by using a Unretained() 7 // VideoCaptureImplManager access this object by using a Unretained()
8 // binding and tasks on the IO thread. It is then important that 8 // binding and tasks on the IO thread. It is then important that
9 // VideoCaptureImpl never post task to itself. All operations must be 9 // VideoCaptureImpl never post task to itself. All operations must be
10 // synchronous. 10 // synchronous.
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 if (state_ == VIDEO_CAPTURE_STATE_STARTED) 127 if (state_ == VIDEO_CAPTURE_STATE_STARTED)
128 GetVideoCaptureHost()->Stop(device_id_); 128 GetVideoCaptureHost()->Stop(device_id_);
129 message_filter_->RemoveDelegate(this); 129 message_filter_->RemoveDelegate(this);
130 } 130 }
131 131
132 void VideoCaptureImpl::SuspendCapture(bool suspend) { 132 void VideoCaptureImpl::SuspendCapture(bool suspend) {
133 DCHECK(io_task_runner_->BelongsToCurrentThread()); 133 DCHECK(io_task_runner_->BelongsToCurrentThread());
134 if (suspend) 134 if (suspend)
135 GetVideoCaptureHost()->Pause(device_id_); 135 GetVideoCaptureHost()->Pause(device_id_);
136 else 136 else
137 Send(new VideoCaptureHostMsg_Resume(device_id_, session_id_, params_)); 137 GetVideoCaptureHost()->Resume(device_id_, session_id_, params_);
138 } 138 }
139 139
140 void VideoCaptureImpl::StartCapture( 140 void VideoCaptureImpl::StartCapture(
141 int client_id, 141 int client_id,
142 const media::VideoCaptureParams& params, 142 const media::VideoCaptureParams& params,
143 const VideoCaptureStateUpdateCB& state_update_cb, 143 const VideoCaptureStateUpdateCB& state_update_cb,
144 const VideoCaptureDeliverFrameCB& deliver_frame_cb) { 144 const VideoCaptureDeliverFrameCB& deliver_frame_cb) {
145 DCHECK(io_task_runner_->BelongsToCurrentThread()); 145 DCHECK(io_task_runner_->BelongsToCurrentThread());
146 ClientInfo client_info; 146 ClientInfo client_info;
147 client_info.params = params; 147 client_info.params = params;
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 params_.requested_format.frame_size.SetSize(width, height); 525 params_.requested_format.frame_size.SetSize(width, height);
526 DVLOG(1) << "RestartCapture, " 526 DVLOG(1) << "RestartCapture, "
527 << params_.requested_format.frame_size.ToString(); 527 << params_.requested_format.frame_size.ToString();
528 StartCaptureInternal(); 528 StartCaptureInternal();
529 } 529 }
530 530
531 void VideoCaptureImpl::StartCaptureInternal() { 531 void VideoCaptureImpl::StartCaptureInternal() {
532 DCHECK(io_task_runner_->BelongsToCurrentThread()); 532 DCHECK(io_task_runner_->BelongsToCurrentThread());
533 DCHECK(device_id_); 533 DCHECK(device_id_);
534 534
535 Send(new VideoCaptureHostMsg_Start(device_id_, session_id_, params_)); 535 GetVideoCaptureHost()->Start(device_id_, session_id_, params_);
536 state_ = VIDEO_CAPTURE_STATE_STARTED; 536 state_ = VIDEO_CAPTURE_STATE_STARTED;
537 } 537 }
538 538
539 void VideoCaptureImpl::Send(IPC::Message* message) { 539 void VideoCaptureImpl::Send(IPC::Message* message) {
540 DCHECK(io_task_runner_->BelongsToCurrentThread()); 540 DCHECK(io_task_runner_->BelongsToCurrentThread());
541 message_filter_->Send(message); 541 message_filter_->Send(message);
542 } 542 }
543 543
544 bool VideoCaptureImpl::RemoveClient(int client_id, ClientInfoMap* clients) { 544 bool VideoCaptureImpl::RemoveClient(int client_id, ClientInfoMap* clients) {
545 DCHECK(io_task_runner_->BelongsToCurrentThread()); 545 DCHECK(io_task_runner_->BelongsToCurrentThread());
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 double consumer_resource_utilization = -1.0; 578 double consumer_resource_utilization = -1.0;
579 if (!metadata->GetDouble(media::VideoFrameMetadata::RESOURCE_UTILIZATION, 579 if (!metadata->GetDouble(media::VideoFrameMetadata::RESOURCE_UTILIZATION,
580 &consumer_resource_utilization)) { 580 &consumer_resource_utilization)) {
581 consumer_resource_utilization = -1.0; 581 consumer_resource_utilization = -1.0;
582 } 582 }
583 583
584 callback_to_io_thread.Run(*release_sync_token, consumer_resource_utilization); 584 callback_to_io_thread.Run(*release_sync_token, consumer_resource_utilization);
585 } 585 }
586 586
587 } // namespace content 587 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698