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

Unified Diff: media/capture/video/fake_video_capture_device_factory.cc

Issue 2606983002: Media Capture Depth Stream Extensions API: focal length and depth range. (Closed)
Patch Set: 80-char line fix in test html. Created 3 years, 10 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/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..3886f48daea5b1e05fadf6c107e3166ae9255dc8 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,18 @@ void FakeVideoCaptureDeviceFactory::GetDeviceDescriptors(
#endif
);
}
+
+ // Video device on index 1 (kDepthDeviceIndex) is depth video capture device.
+ // Fill the camera calibration information only for it.
+ if (device_descriptors->size() <= kDepthDeviceIndex)
+ 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(
« no previous file with comments | « media/capture/ipc/capture_param_traits_macros.h ('k') | media/capture/video/fake_video_capture_device_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698