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

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

Issue 2379253003: Video Capture Service: typemap video_capture's and media's VideoCaptureFormat (Closed)
Patch Set: more traits methods inlining 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" 7 #include "services/video_capture/mojo_media_conversions.h"
8 #include "services/video_capture/video_capture_device_proxy_impl.h" 8 #include "services/video_capture/video_capture_device_proxy_impl.h"
9 9
10 namespace video_capture { 10 namespace video_capture {
11 11
12 VideoCaptureDeviceProxyImpl::VideoCaptureDeviceProxyImpl( 12 VideoCaptureDeviceProxyImpl::VideoCaptureDeviceProxyImpl(
13 std::unique_ptr<media::VideoCaptureDevice> device) 13 std::unique_ptr<media::VideoCaptureDevice> device)
14 : device_(std::move(device)) {} 14 : device_(std::move(device)) {}
15 15
16 VideoCaptureDeviceProxyImpl::~VideoCaptureDeviceProxyImpl() { 16 VideoCaptureDeviceProxyImpl::~VideoCaptureDeviceProxyImpl() {
17 if (device_running_) 17 if (device_running_)
18 device_->StopAndDeAllocate(); 18 device_->StopAndDeAllocate();
19 } 19 }
20 20
21 void VideoCaptureDeviceProxyImpl::Start( 21 void VideoCaptureDeviceProxyImpl::Start(
22 mojom::VideoCaptureFormatPtr requested_format, 22 const media::VideoCaptureFormat& requested_format,
23 mojom::ResolutionChangePolicy resolution_change_policy, 23 mojom::ResolutionChangePolicy resolution_change_policy,
24 mojom::PowerLineFrequency power_line_frequency, 24 mojom::PowerLineFrequency power_line_frequency,
25 mojom::VideoCaptureDeviceClientPtr client) { 25 mojom::VideoCaptureDeviceClientPtr client) {
26 media::VideoCaptureParams params; 26 media::VideoCaptureParams params;
27 params.requested_format = ConvertFromMojoToMedia(std::move(requested_format)); 27 params.requested_format = requested_format;
28 params.resolution_change_policy = 28 params.resolution_change_policy =
29 ConvertFromMojoToMedia(resolution_change_policy); 29 ConvertFromMojoToMedia(resolution_change_policy);
30 params.power_line_frequency = ConvertFromMojoToMedia(power_line_frequency); 30 params.power_line_frequency = ConvertFromMojoToMedia(power_line_frequency);
31 client.set_connection_error_handler( 31 client.set_connection_error_handler(
32 base::Bind(&VideoCaptureDeviceProxyImpl::OnClientConnectionErrorOrClose, 32 base::Bind(&VideoCaptureDeviceProxyImpl::OnClientConnectionErrorOrClose,
33 base::Unretained(this))); 33 base::Unretained(this)));
34 auto media_client = 34 auto media_client =
35 base::MakeUnique<DeviceClientMojoToMediaAdapter>(std::move(client)); 35 base::MakeUnique<DeviceClientMojoToMediaAdapter>(std::move(client));
36 device_->AllocateAndStart(params, std::move(media_client)); 36 device_->AllocateAndStart(params, std::move(media_client));
37 device_running_ = true; 37 device_running_ = true;
38 } 38 }
39 39
40 void VideoCaptureDeviceProxyImpl::Stop() { 40 void VideoCaptureDeviceProxyImpl::Stop() {
41 device_->StopAndDeAllocate(); 41 device_->StopAndDeAllocate();
42 device_running_ = false; 42 device_running_ = false;
43 } 43 }
44 44
45 void VideoCaptureDeviceProxyImpl::OnClientConnectionErrorOrClose() { 45 void VideoCaptureDeviceProxyImpl::OnClientConnectionErrorOrClose() {
46 device_->StopAndDeAllocate(); 46 device_->StopAndDeAllocate();
47 } 47 }
48 48
49 } // namespace video_capture 49 } // 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