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

Side by Side Diff: media/capture/video/chromeos/video_capture_device_factory_chromeos.cc

Issue 2837273004: media: add video capture device for ARC++ camera HAL v3 (Closed)
Patch Set: Created 3 years, 8 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
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "media/capture/video/chromeos/video_capture_device_factory_chromeos.h"
6
7 namespace media {
8
9 VideoCaptureDeviceFactoryChromeOS::VideoCaptureDeviceFactoryChromeOS(
10 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner)
11 : ui_task_runner_(ui_task_runner), module_thread_("CameraModuleThread") {}
12
13 VideoCaptureDeviceFactoryChromeOS::~VideoCaptureDeviceFactoryChromeOS() {}
14
15 bool VideoCaptureDeviceFactoryChromeOS::Init() {
chfremer 2017/04/26 21:13:05 Add DCHECK(thread_checker_.CalledOnValidThread());
jcliang 2017/04/27 07:07:57 Init is called on the browser IO thread when we cr
16 if (!module_thread_.Start()) {
17 LOG(ERROR) << "Module thread failed to start";
18 return false;
19 }
20 camera_hal_delegate_ = new CameraHalDelegate(module_thread_.task_runner());
21 return camera_hal_delegate_->StartCameraModuleIpc();
22 }
23
24 std::unique_ptr<VideoCaptureDevice>
25 VideoCaptureDeviceFactoryChromeOS::CreateDevice(
26 const VideoCaptureDeviceDescriptor& device_descriptor) {
27 DCHECK(thread_checker_.CalledOnValidThread());
28 return camera_hal_delegate_->CreateDevice(ui_task_runner_, device_descriptor);
29 }
30
31 void VideoCaptureDeviceFactoryChromeOS::GetSupportedFormats(
32 const VideoCaptureDeviceDescriptor& device_descriptor,
33 VideoCaptureFormats* supported_formats) {
34 DCHECK(thread_checker_.CalledOnValidThread());
35 camera_hal_delegate_->GetSupportedFormats(device_descriptor,
36 supported_formats);
37 }
38
39 void VideoCaptureDeviceFactoryChromeOS::GetDeviceDescriptors(
40 VideoCaptureDeviceDescriptors* device_descriptors) {
41 DCHECK(thread_checker_.CalledOnValidThread());
42 camera_hal_delegate_->GetDeviceDescriptors(device_descriptors);
43 }
44
45 #if defined(OS_CHROMEOS)
46 // static
47 VideoCaptureDeviceFactory*
48 VideoCaptureDeviceFactory::CreateVideoCaptureDeviceFactory(
49 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) {
50 std::unique_ptr<VideoCaptureDeviceFactoryChromeOS> factory(
51 new VideoCaptureDeviceFactoryChromeOS(ui_task_runner));
52 if (!factory->Init()) {
53 return nullptr;
54 }
55 return factory.release();
56 }
57 #endif
58
59 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698