From 409cccb47762ba310f12014df5f365ced07ddf96 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Tue, 8 Apr 2014 18:17:31 -0400 Subject: [PATCH] v4l2object: Workaround decoder that set num_planes to 0 in the format Some well known decoder wrongly set num_planes to 0 in their format instead of one. In this case we would endup with no size when deciding buffer allocation. --- sys/v4l2/gstv4l2object.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c index 78fbb46..661d6d3 100644 --- a/sys/v4l2/gstv4l2object.c +++ b/sys/v4l2/gstv4l2object.c @@ -2286,7 +2286,7 @@ gst_v4l2_object_save_format (GstV4l2Object * v4l2object, /* figure out the frame layout */ v4l2object->n_v4l2_planes = MAX (1, format->fmt.pix_mp.num_planes); v4l2object->sizeimage = 0; - for (i = 0; i < format->fmt.pix_mp.num_planes; i++) { + for (i = 0; i < v4l2object->n_v4l2_planes; i++) { v4l2object->bytesperline[i] = format->fmt.pix_mp.plane_fmt[i].bytesperline; v4l2object->sizeimage += format->fmt.pix_mp.plane_fmt[i].sizeimage; -- 2.7.4