summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuli Piippo <samuli.piippo@qt.io>2022-12-23 07:50:09 +0000
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-01-03 17:21:33 +0000
commit8a8d44d28cfb7ff3f6d7ce50eabc58fe236a0aa9 (patch)
tree4302c6c19bf45d9e2588795e607e10c07f2dd97d
parent3ad0b471a921fd1725c8477b4f2e947571335777 (diff)
ffmpeg: avoid infinite loop with non-discreate framesizes
The v4l2 camera checkup can properly handly only discrete types. In case ioctl reports anything else, make sure we increase the index to avoid getting stuck on infinite loop. Fixes: QTBUG-109535 Change-Id: I7e669b8167361875b75d4eece5c0c9a92a76c331 Reviewed-by: Artem Dyomin <artem.dyomin@qt.io> Reviewed-by: Lars Knoll <lars@knoll.priv.no> (cherry picked from commit 8897d36de57db3ce9d75fbd87bcec96bbbd4d69f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/plugins/multimedia/ffmpeg/qv4l2camera.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/plugins/multimedia/ffmpeg/qv4l2camera.cpp b/src/plugins/multimedia/ffmpeg/qv4l2camera.cpp
index 0f7a8c91a..3e53d6322 100644
--- a/src/plugins/multimedia/ffmpeg/qv4l2camera.cpp
+++ b/src/plugins/multimedia/ffmpeg/qv4l2camera.cpp
@@ -150,6 +150,7 @@ void QV4L2CameraDevices::doCheckCameras()
frameSize.pixel_format = formatDesc.pixelformat;
while (!ioctl(fd, VIDIOC_ENUM_FRAMESIZES, &frameSize)) {
+ ++frameSize.index;
if (frameSize.type != V4L2_FRMSIZE_TYPE_DISCRETE)
continue;
@@ -163,9 +164,9 @@ void QV4L2CameraDevices::doCheckCameras()
frameInterval.height = frameSize.discrete.height;
while (!ioctl(fd, VIDIOC_ENUM_FRAMEINTERVALS, &frameInterval)) {
+ ++frameInterval.index;
if (frameInterval.type != V4L2_FRMIVAL_TYPE_DISCRETE)
continue;
- ++frameInterval.index;
float rate = float(frameInterval.discrete.denominator)/float(frameInterval.discrete.numerator);
if (rate > max)
max = rate;
@@ -174,7 +175,6 @@ void QV4L2CameraDevices::doCheckCameras()
}
// qCDebug(qLV4L2Camera) << " " << resolution << min << max;
- ++frameSize.index;
if (min <= max) {
QCameraFormatPrivate *fmt = new QCameraFormatPrivate;