From a87be69ce5eb6b91dc53732b4fcfad4bb77fb87b Mon Sep 17 00:00:00 2001 From: Trung Do Date: Mon, 1 Nov 2021 10:08:32 +0700 Subject: [PATCH] v4l2: Update fmt if padded height is greater than fmt height If padded height is greater, buffer bytesused could be larger than plane length, and cause VIDIOC_QBUF failure. Part-of: --- subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c index 9851ffc..43121f6 100644 --- a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c +++ b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2object.c @@ -4597,6 +4597,18 @@ gst_v4l2_object_match_buffer_layout (GstV4l2Object * obj, guint n_planes, offset[p], obj->info.offset[p], p); need_fmt_update = TRUE; } + + if (padded_height) { + guint fmt_height; + + if (V4L2_TYPE_IS_MULTIPLANAR (obj->type)) + fmt_height = obj->format.fmt.pix_mp.height; + else + fmt_height = obj->format.fmt.pix.height; + + if (padded_height > fmt_height) + need_fmt_update = TRUE; + } } if (need_fmt_update) { -- 2.7.4