Freescale / gstreamer-imx

GStreamer 1.0 plugins for i.MX platforms
Other
184 stars 127 forks source link

Wrong ioctl param while enumerating frame intervals (VIDIOC_ENUM_FRAMESIZES) #295

Closed dierberg closed 2 years ago

dierberg commented 3 years ago

gstimxv4l2context.c line 1005 uses VIDIOC_ENUM_FRAMESIZES, must be VIDIOC_ENUM_FRAMEINTERVALS

if (ioctl(fd, VIDIOC_ENUM_FRAMESIZES, &v4l2_frame_interval) < 0)

Due to a missing v4l2_frame_interval.index++; we run into an endless loop too.

dierberg commented 3 years ago
From 26d6d841bb4219138afeeff0a21abdfc6f6d1bcc Mon Sep 17 00:00:00 2001
From: Sascha Dierberg <dierberg@dresearch-fe.de>
Date: Tue, 14 Sep 2021 10:41:59 +0200
Subject: [PATCH 1/1] gstimxv4l2videosrc: ioctl enum fixed #295

Signed-off-by: Sascha Dierberg <dierberg@dresearch-fe.de>
---
 sys/v4l2video/gstimxv4l2context.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/v4l2video/gstimxv4l2context.c b/sys/v4l2video/gstimxv4l2context.c
index a838b8e..8ebb554 100644
--- a/sys/v4l2video/gstimxv4l2context.c
+++ b/sys/v4l2video/gstimxv4l2context.c
@@ -1002,7 +1002,7 @@ static gboolean fill_caps_with_probed_info(GstImxV4L2Context *self, int fd, GstC
                        gst_value_set_fraction(&framerate_gvalue, fps_num, fps_denom);
                        gst_value_list_append_value(&framerates_gvalue, &framerate_gvalue);

-                       if (ioctl(fd, VIDIOC_ENUM_FRAMESIZES, &v4l2_frame_interval) < 0)
+                       if (ioctl(fd, VIDIOC_ENUM_FRAMEINTERVALS, &v4l2_frame_interval) < 0)
                        {
                            if (errno == EINVAL)
                            {
@@ -1016,6 +1016,7 @@ static gboolean fill_caps_with_probed_info(GstImxV4L2Context *self, int fd, GstC
                                break;
                            }
                        }
+                       v4l2_frame_interval.index++;
                    }

                    gst_structure_set_value(structure, "framerate", &framerates_gvalue);
-- 
2.26.2