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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1355>
This commit is contained in:
Trung Do 2021-11-01 10:08:32 +07:00 committed by Nicolas Dufresne
parent 6d7dc93a45
commit a87be69ce5

View file

@ -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) {