From b80169a16abb8526e5d766fa3e7cc04c6667db3e Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Mon, 2 Dec 2013 15:26:50 -0500 Subject: [PATCH] v4l2object: Don't validate dimension for encoded format We set the dimensions just in case but don't validate them afterwards. For some codecs the dimensions are *not* in the bitstream, IIRC VC1 in ASF mode for example. https://bugzilla.gnome.org/show_bug.cgi?id=720568 --- sys/v4l2/gstv4l2object.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/sys/v4l2/gstv4l2object.c b/sys/v4l2/gstv4l2object.c index 7a0c87bb80..a3dbc5f117 100644 --- a/sys/v4l2/gstv4l2object.c +++ b/sys/v4l2/gstv4l2object.c @@ -2604,13 +2604,18 @@ gst_v4l2_object_set_format (GstV4l2Object * v4l2object, GstCaps * caps) format.fmt.pix_mp.plane_fmt[i].bytesperline); #endif - if (format.fmt.pix_mp.width != width - || format.fmt.pix_mp.height != height) - goto invalid_dimensions; - if (format.fmt.pix_mp.pixelformat != pixelformat) goto invalid_pixelformat; + /* we set the dimensions just in case but don't validate them afterwards + * For some codecs the dimensions are *not* in the bitstream, IIRC VC1 + * in ASF mode for example. */ + if (info.finfo->format != GST_VIDEO_FORMAT_ENCODED) { + if (format.fmt.pix_mp.width != width + || format.fmt.pix_mp.height != height) + goto invalid_dimensions; + } + if (format.fmt.pix_mp.num_planes != n_v4l_planes) goto invalid_planes; } @@ -2659,8 +2664,13 @@ gst_v4l2_object_set_format (GstV4l2Object * v4l2object, GstCaps * caps) format.fmt.pix.height, GST_FOURCC_ARGS (format.fmt.pix.pixelformat), format.fmt.pix.bytesperline); - if (format.fmt.pix.width != width || format.fmt.pix.height != height) - goto invalid_dimensions; + /* we set the dimensions just in case but don't validate them afterwards + * For some codecs the dimensions are *not* in the bitstream, IIRC VC1 + * in ASF mode for example. */ + if (info.finfo->format != GST_VIDEO_FORMAT_ENCODED) { + if (format.fmt.pix.width != width || format.fmt.pix.height != height) + goto invalid_dimensions; + } if (format.fmt.pix.pixelformat != pixelformat) goto invalid_pixelformat;