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

Side by Side Diff: services/video_capture/video_capture_device_proxy_impl.cc

Issue 2395163002: VideoCapture: migrate VideoCapture renderer-->host messages to mojo, part 2 (Closed)
Patch Set: rockot@s comments on renaming and return types 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
« no previous file with comments | « services/video_capture/video_capture_device_proxy_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "base/logging.h" 5 #include "base/logging.h"
6 #include "services/video_capture/device_client_mojo_to_media_adapter.h" 6 #include "services/video_capture/device_client_mojo_to_media_adapter.h"
7 #include "services/video_capture/mojo_media_conversions.h"
8 #include "services/video_capture/video_capture_device_proxy_impl.h" 7 #include "services/video_capture/video_capture_device_proxy_impl.h"
9 8
10 namespace video_capture { 9 namespace video_capture {
11 10
12 VideoCaptureDeviceProxyImpl::VideoCaptureDeviceProxyImpl( 11 VideoCaptureDeviceProxyImpl::VideoCaptureDeviceProxyImpl(
13 std::unique_ptr<media::VideoCaptureDevice> device) 12 std::unique_ptr<media::VideoCaptureDevice> device)
14 : device_(std::move(device)) {} 13 : device_(std::move(device)) {}
15 14
16 VideoCaptureDeviceProxyImpl::~VideoCaptureDeviceProxyImpl() { 15 VideoCaptureDeviceProxyImpl::~VideoCaptureDeviceProxyImpl() {
17 if (device_running_) 16 if (device_running_)
18 device_->StopAndDeAllocate(); 17 device_->StopAndDeAllocate();
19 } 18 }
20 19
21 void VideoCaptureDeviceProxyImpl::Start( 20 void VideoCaptureDeviceProxyImpl::Start(
22 const media::VideoCaptureFormat& requested_format, 21 const media::VideoCaptureFormat& requested_format,
23 mojom::ResolutionChangePolicy resolution_change_policy, 22 media::ResolutionChangePolicy resolution_change_policy,
24 mojom::PowerLineFrequency power_line_frequency, 23 media::PowerLineFrequency power_line_frequency,
25 mojom::VideoCaptureDeviceClientPtr client) { 24 mojom::VideoCaptureDeviceClientPtr client) {
26 media::VideoCaptureParams params; 25 media::VideoCaptureParams params;
27 params.requested_format = requested_format; 26 params.requested_format = requested_format;
28 params.resolution_change_policy = 27 params.resolution_change_policy = resolution_change_policy;
29 ConvertFromMojoToMedia(resolution_change_policy); 28 params.power_line_frequency = power_line_frequency;
30 params.power_line_frequency = ConvertFromMojoToMedia(power_line_frequency);
31 client.set_connection_error_handler( 29 client.set_connection_error_handler(
32 base::Bind(&VideoCaptureDeviceProxyImpl::OnClientConnectionErrorOrClose, 30 base::Bind(&VideoCaptureDeviceProxyImpl::OnClientConnectionErrorOrClose,
33 base::Unretained(this))); 31 base::Unretained(this)));
34 auto media_client = 32 auto media_client =
35 base::MakeUnique<DeviceClientMojoToMediaAdapter>(std::move(client)); 33 base::MakeUnique<DeviceClientMojoToMediaAdapter>(std::move(client));
36 device_->AllocateAndStart(params, std::move(media_client)); 34 device_->AllocateAndStart(params, std::move(media_client));
37 device_running_ = true; 35 device_running_ = true;
38 } 36 }
39 37
40 void VideoCaptureDeviceProxyImpl::Stop() { 38 void VideoCaptureDeviceProxyImpl::Stop() {
41 device_->StopAndDeAllocate(); 39 device_->StopAndDeAllocate();
42 device_running_ = false; 40 device_running_ = false;
43 } 41 }
44 42
45 void VideoCaptureDeviceProxyImpl::OnClientConnectionErrorOrClose() { 43 void VideoCaptureDeviceProxyImpl::OnClientConnectionErrorOrClose() {
46 device_->StopAndDeAllocate(); 44 device_->StopAndDeAllocate();
47 } 45 }
48 46
49 } // namespace video_capture 47 } // namespace video_capture
OLDNEW
« no previous file with comments | « services/video_capture/video_capture_device_proxy_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698