Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 #ifndef MEDIA_CAPTURE_VIDEO_CHROMEOS_VIDEO_CAPTURE_DEVICE_FACTORY_CHROMEOS_H_ | |
| 6 #define MEDIA_CAPTURE_VIDEO_CHROMEOS_VIDEO_CAPTURE_DEVICE_FACTORY_CHROMEOS_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "media/capture/video/chromeos/camera_hal_delegate.h" | |
| 12 #include "media/capture/video/video_capture_device_factory.h" | |
| 13 | |
| 14 namespace media { | |
| 15 | |
| 16 class CAPTURE_EXPORT VideoCaptureDeviceFactoryChromeOS final | |
| 17 : public VideoCaptureDeviceFactory { | |
| 18 public: | |
| 19 VideoCaptureDeviceFactoryChromeOS( | |
|
wuchengli
2017/04/28 06:29:28
explicit
jcliang
2017/04/28 08:27:49
Done.
| |
| 20 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner); | |
| 21 | |
| 22 ~VideoCaptureDeviceFactoryChromeOS(); | |
| 23 | |
| 24 // VideoCaptureDeviceFactory interface implementations. | |
| 25 std::unique_ptr<VideoCaptureDevice> CreateDevice( | |
| 26 const VideoCaptureDeviceDescriptor& device_descriptor) final; | |
| 27 void GetSupportedFormats( | |
| 28 const VideoCaptureDeviceDescriptor& device_descriptor, | |
| 29 VideoCaptureFormats* supported_formats) final; | |
| 30 void GetDeviceDescriptors( | |
| 31 VideoCaptureDeviceDescriptors* device_descriptors) final; | |
| 32 | |
| 33 // Initializes the factory. The factory is functional only after this call | |
| 34 // succeeds. This method is called on the browser IO thread when the factory | |
|
wuchengli
2017/04/28 06:29:28
Check why this is on IO thread. From the code, thi
jcliang
2017/04/28 08:27:49
I just verified this by manually inserting logs in
chfremer
2017/04/28 16:57:18
That is my bad. I changed this threading in a rece
jcliang
2017/04/29 06:55:38
Uploaded another CL for the fix: https://coderevie
| |
| 35 // instance is created. | |
| 36 bool Init(); | |
| 37 | |
| 38 private: | |
| 39 const scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | |
| 40 | |
| 41 // The thread that all the Mojo operations of |camera_hal_delegate_| take | |
| 42 // place. Started in Init and stopped when the class instance is destroyed. | |
|
wuchengli
2017/04/28 06:29:28
Can we make Start and Stop run on the same thread?
jcliang
2017/04/28 08:27:49
The thread is started on UI thread when the browse
| |
| 43 base::Thread module_thread_; | |
| 44 | |
| 45 // Communication interface to the camera HAL. |camera_hal_delegate_| is | |
| 46 // created on the thread where the VideoCaptureDeviceFactoryChromeOS was | |
| 47 // instantiated. All the Mojo communication that |camera_hal_delegate_| | |
| 48 // issues and receives must be sequenced through |module_thread_|. | |
| 49 scoped_refptr<CameraHalDelegate> camera_hal_delegate_; | |
| 50 | |
| 51 DISALLOW_COPY_AND_ASSIGN(VideoCaptureDeviceFactoryChromeOS); | |
| 52 }; | |
| 53 | |
| 54 } // namespace media | |
| 55 | |
| 56 #endif // MEDIA_CAPTURE_VIDEO_CHROMEOS_VIDEO_CAPTURE_DEVICE_FACTORY_CHROMEOS_H_ | |
| OLD | NEW |