[vlc-devel] [PATCH] v4l2: Fix SetupFormat for CONTINUOUS framesize

Ricardo Ribalda Delgado ricardo.ribalda at gmail.com
Fri Aug 21 16:35:20 CEST 2015


Some devices with CONTINUOUS framesize can set step_width or step_height
to zero, entering an endless loop.

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda at gmail.com>
---
 modules/access/v4l2/video.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/modules/access/v4l2/video.c b/modules/access/v4l2/video.c
index b8544ea7ec95..662d2f63646c 100644
--- a/modules/access/v4l2/video.c
+++ b/modules/access/v4l2/video.c
@@ -499,9 +499,15 @@ int SetupFormat (vlc_object_t *obj, int fd, uint32_t fourcc,
                      "%"PRIu32"x%"PRIu32" supported",
                      fse.stepwise.min_width, fse.stepwise.min_height,
                      fse.stepwise.max_width, fse.stepwise.max_height);
-            if (fse.type == V4L2_FRMSIZE_TYPE_STEPWISE)
-                msg_Dbg (obj, "  with %"PRIu32"x%"PRIu32" steps",
-                         fse.stepwise.step_width, fse.stepwise.step_height);
+
+	    if (!fse.stepwise.step_height)
+                     fse.stepwise.step_height = 1;
+
+	    if (!fse.stepwise.step_width)
+                     fse.stepwise.step_width = 1;
+
+            msg_Dbg (obj, "  with %"PRIu32"x%"PRIu32" steps",
+                     fse.stepwise.step_width, fse.stepwise.step_height);
 
             /* FIXME: slow and dumb */
             for (uint32_t width =  fse.stepwise.min_width;
-- 
2.5.0



More information about the vlc-devel mailing list