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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: media/capture/video/chromeos/video_capture_device_factory_chromeos.cc
diff --git a/media/capture/video/chromeos/video_capture_device_factory_chromeos.cc b/media/capture/video/chromeos/video_capture_device_factory_chromeos.cc
new file mode 100644
index 0000000000000000000000000000000000000000..3bfb0859105d33059ad4a077bfb6b17eb3d74860
--- /dev/null
+++ b/media/capture/video/chromeos/video_capture_device_factory_chromeos.cc
@@ -0,0 +1,59 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/capture/video/chromeos/video_capture_device_factory_chromeos.h"
+
+namespace media {
+
+VideoCaptureDeviceFactoryChromeOS::VideoCaptureDeviceFactoryChromeOS(
+ scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner)
+ : ui_task_runner_(ui_task_runner), module_thread_("CameraModuleThread") {}
+
+VideoCaptureDeviceFactoryChromeOS::~VideoCaptureDeviceFactoryChromeOS() {}
+
+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
+ if (!module_thread_.Start()) {
+ LOG(ERROR) << "Module thread failed to start";
+ return false;
+ }
+ camera_hal_delegate_ = new CameraHalDelegate(module_thread_.task_runner());
+ return camera_hal_delegate_->StartCameraModuleIpc();
+}
+
+std::unique_ptr<VideoCaptureDevice>
+VideoCaptureDeviceFactoryChromeOS::CreateDevice(
+ const VideoCaptureDeviceDescriptor& device_descriptor) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ return camera_hal_delegate_->CreateDevice(ui_task_runner_, device_descriptor);
+}
+
+void VideoCaptureDeviceFactoryChromeOS::GetSupportedFormats(
+ const VideoCaptureDeviceDescriptor& device_descriptor,
+ VideoCaptureFormats* supported_formats) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ camera_hal_delegate_->GetSupportedFormats(device_descriptor,
+ supported_formats);
+}
+
+void VideoCaptureDeviceFactoryChromeOS::GetDeviceDescriptors(
+ VideoCaptureDeviceDescriptors* device_descriptors) {
+ DCHECK(thread_checker_.CalledOnValidThread());
+ camera_hal_delegate_->GetDeviceDescriptors(device_descriptors);
+}
+
+#if defined(OS_CHROMEOS)
+// static
+VideoCaptureDeviceFactory*
+VideoCaptureDeviceFactory::CreateVideoCaptureDeviceFactory(
+ scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner) {
+ std::unique_ptr<VideoCaptureDeviceFactoryChromeOS> factory(
+ new VideoCaptureDeviceFactoryChromeOS(ui_task_runner));
+ if (!factory->Init()) {
+ return nullptr;
+ }
+ return factory.release();
+}
+#endif
+
+} // namespace media

Powered by Google App Engine
This is Rietveld 408576698