Chromium Code Reviews| Index: media/capture/video/fake_video_capture_device_factory.cc |
| diff --git a/media/capture/video/fake_video_capture_device_factory.cc b/media/capture/video/fake_video_capture_device_factory.cc |
| index d20749c2723fc05483314e89352fbc691c48bd86..5cda9f9d38bd8c534e80953a0f53ce9acc373b90 100644 |
| --- a/media/capture/video/fake_video_capture_device_factory.cc |
| +++ b/media/capture/video/fake_video_capture_device_factory.cc |
| @@ -15,11 +15,14 @@ |
| namespace { |
| +static const size_t kDepthDeviceIndex = 1; |
| +static const char kDepthDeviceId[] = "/dev/video1"; |
| + |
| // Factory has one device by default; I420. If there are more, the second device |
| // is of Y16 format while the rest are I420. |
| media::VideoPixelFormat GetPixelFormat(const std::string& device_id) { |
| - return (device_id == "/dev/video1") ? media::PIXEL_FORMAT_Y16 |
| - : media::PIXEL_FORMAT_I420; |
| + return (device_id == kDepthDeviceId) ? media::PIXEL_FORMAT_Y16 |
| + : media::PIXEL_FORMAT_I420; |
| } |
| } |
| @@ -82,6 +85,17 @@ void FakeVideoCaptureDeviceFactory::GetDeviceDescriptors( |
| #endif |
| ); |
| } |
| + |
| + // Fill the camera calibration information for depth device. |
| + if (device_descriptors->size() <= kDepthDeviceIndex) |
|
mcasas
2017/01/11 23:18:20
s/<=/!=/ ?
IIRC only the 1st device (numbering fr
aleksandar.stojiljkovic
2017/01/12 14:13:59
The code is correct here - it is just a bounds che
|
| + return; |
| + VideoCaptureDeviceDescriptor& depth_device( |
| + (*device_descriptors)[kDepthDeviceIndex]); |
| + depth_device.camera_calibration.emplace(); |
| + depth_device.camera_calibration->focal_length_x = 135.0; |
| + depth_device.camera_calibration->focal_length_y = 135.6; |
| + depth_device.camera_calibration->depth_near = 0.0; |
| + depth_device.camera_calibration->depth_far = 65.535; |
| } |
| void FakeVideoCaptureDeviceFactory::GetSupportedFormats( |