Chromium Code Reviews| Index: media/capture/video/linux/video_capture_device_linux.cc |
| diff --git a/media/capture/video/linux/video_capture_device_linux.cc b/media/capture/video/linux/video_capture_device_linux.cc |
| index a1b2855055e853b5e1d9210f5da139f8740ef7ec..2d6d5d3231db8284751cf1a559c1fad0ef753e2b 100644 |
| --- a/media/capture/video/linux/video_capture_device_linux.cc |
| +++ b/media/capture/video/linux/video_capture_device_linux.cc |
| @@ -11,6 +11,7 @@ |
| #include "base/bind.h" |
| #include "base/single_thread_task_runner.h" |
| #include "build/build_config.h" |
| +#include "media/capture/video/linux/camera_characteristics.h" |
| #include "media/capture/video/linux/v4l2_capture_delegate.h" |
| #if defined(OS_OPENBSD) |
| @@ -38,7 +39,8 @@ std::list<uint32_t> VideoCaptureDeviceLinux::GetListOfUsableFourCCs( |
| VideoCaptureDeviceLinux::VideoCaptureDeviceLinux( |
| const VideoCaptureDeviceDescriptor& device_descriptor) |
| : v4l2_thread_("V4L2CaptureThread"), |
| - device_descriptor_(device_descriptor) {} |
| + device_descriptor_(device_descriptor), |
| + is_back_camera_(GetCameraFacing(device_descriptor)) {} |
| VideoCaptureDeviceLinux::~VideoCaptureDeviceLinux() { |
| // Check if the thread is running. |
| @@ -63,6 +65,7 @@ void VideoCaptureDeviceLinux::AllocateAndStart( |
| client->OnError(FROM_HERE, "Failed to create VideoCaptureDelegate"); |
| return; |
| } |
| + client->SetCameraFacing(is_back_camera_); |
| v4l2_thread_.task_runner()->PostTask( |
| FROM_HERE, |
| base::Bind(&V4L2CaptureDelegate::AllocateAndStart, capture_impl_, |
| @@ -133,4 +136,10 @@ int VideoCaptureDeviceLinux::TranslatePowerLineFrequencyToV4L2( |
| } |
| } |
| +bool VideoCaptureDeviceLinux::GetCameraFacing( |
|
wuchengli
2016/11/16 12:15:19
This is just two lines of code. We don't need a fu
shenghao
2016/11/17 08:41:44
But I need it to be a function so that I can initi
wuchengli
2016/11/17 09:26:04
Why not initialize it in the constructor?
shenghao
2016/11/17 10:15:54
Done.
|
| + const VideoCaptureDeviceDescriptor& descriptor) { |
| + CameraCharacteristics characteristics; |
| + return characteristics.GetCameraFacing(descriptor.model_id) == 1; |
|
wuchengli
2016/11/16 12:15:19
Need a constant for 0 and 1.
shenghao
2016/11/17 08:41:44
Done.
|
| +} |
| + |
| } // namespace media |