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

Unified Diff: media/video/capture/linux/video_capture_device_factory_linux.cc

Issue 544033002: Linux video capture: handle devices that don't enumerate any frame rates (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/video/capture/linux/video_capture_device_factory_linux.cc
diff --git a/media/video/capture/linux/video_capture_device_factory_linux.cc b/media/video/capture/linux/video_capture_device_factory_linux.cc
index 4cb08000f19af6ef70b0e22790995354b5481a44..6cb77fa443c43bbb09e04c3ab4150d6cab3f9854 100644
--- a/media/video/capture/linux/video_capture_device_factory_linux.cc
+++ b/media/video/capture/linux/video_capture_device_factory_linux.cc
@@ -155,15 +155,14 @@ void VideoCaptureDeviceFactoryLinux::GetDeviceSupportedFormats(
frame_interval.pixel_format = pixel_format.pixelformat;
frame_interval.width = frame_size.discrete.width;
frame_interval.height = frame_size.discrete.height;
+ std::list<float> frame_rates;
while (HANDLE_EINTR(ioctl(
fd.get(), VIDIOC_ENUM_FRAMEINTERVALS, &frame_interval)) == 0) {
if (frame_interval.type == V4L2_FRMIVAL_TYPE_DISCRETE) {
if (frame_interval.discrete.numerator != 0) {
- supported_format.frame_rate =
+ frame_rates.push_back(
static_cast<float>(frame_interval.discrete.denominator) /
- static_cast<float>(frame_interval.discrete.numerator);
- } else {
- supported_format.frame_rate = 0;
+ static_cast<float>(frame_interval.discrete.numerator));
}
} else if (frame_interval.type == V4L2_FRMIVAL_TYPE_CONTINUOUS) {
// TODO(mcasas): see http://crbug.com/249953, support these devices.
@@ -174,9 +173,20 @@ void VideoCaptureDeviceFactoryLinux::GetDeviceSupportedFormats(
NOTIMPLEMENTED();
break;
}
+ ++frame_interval.index;
+ }
+
+ // Some devices, e.g. Kinect, do not enumerate any frame rates. For these
+ // devices, we do not want to lose all enumeration (pixel format and
+ // resolution), so we return a frame rate of zero instead.
+ if (frame_rates.empty())
+ frame_rates.push_back(0);
+
+ for (std::list<float>::iterator it = frame_rates.begin();
magjed_chromium 2014/09/05 09:09:35 C++11 range-based for loops are not allowed in chr
+ it != frame_rates.end();
+ ++it) {
supported_formats->push_back(supported_format);
DVLOG(1) << device.name() << " " << supported_format.ToString();
- ++frame_interval.index;
}
++frame_size.index;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698