gst-plugins-good: gst_v4l2_object_get_nearest_size bug

Henrique Camargo henrique at
Mon Oct 1 11:21:05 PDT 2012

My co-worker Diogo Luvizon filed the bug report and attached a patch
that fixes the problem.

You can find it in:

Thank you for the information and fast response!

On Sat, Fri, 28 Sep 2012 at 16:34:43,  Nicolas Dufresne
<nicolas.dufresne at> wrote:
> Same here, you should file a bug. You will then be able to attach your
> patches to that bug. Before doing so, check that this bug does not
> already exist, e.g.
> seems slightly similar.
> Component is gst-plugins-good.
> best regards,
> Nicolas
> Le vendredi 28 septembre 2012 ? 17:17 -0300, Henrique Camargo a ?crit :
>> I was investigating a bug that is happening on a v4l2 driver (Davinci
>> VPFE Capture device) I was working on, that investigation led me to
>> the gstreamer code.
>> I think I found a bug in the function
>> gst_v4l2_object_get_nearest_size inside the v4l2 plugin
>> (gstv4l2object.c).  I'm running gst-plugins-good-0.10.31 and
>> gstreamer-0.10.36 compiled using Buildroot with a ARM9 target. Maybe
>> someone can answer me some questions?
>> As I understood from the code, this function tries to find the nearest
>> frame size and it does it using the TRY_FMT ioctl. If the TRY_FMT is
>> not implemented in the device it uses S_FMT. But, S_FMT has the side
>> effect of changing the device's operation mode. So the first thing
>> that gst_v4l2_object_get_nearest_size does is to do a G_FMT to save
>> the previous format so it can restore it latter (after the S_FMT
>> call).
>> It saves the format in a variable called prevfmt. But it forgets to
>> set the type of the format, so the call:
>> prevfmt_valid = (v4l2_ioctl (fd, VIDIOC_G_FMT, &prevfmt) >= 0);
>> Always fails.
>> If TRY_FMT is not implemented,  gst_v4l2_object_get_nearest_size will
>> use S_FMT and will change the device's operation mode, since it failed
>> to save the previous format it will be unable to restore it.
>> Am I correct? If needed, I can provide a patch (I already made the
>> necessary modification).
>> Thank you,

Henrique Camargo

Email: henrique at
Phone: +55 41 99152915

More information about the gstreamer-devel mailing list