gst-plugins-good: gst_v4l2_object_get_nearest_size bug

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

gst-plugins-good: gst_v4l2_object_get_nearest_size bug

Henrique Camargo
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: [hidden email]
Phone: +55 41 99152915
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gst-plugins-good: gst_v4l2_object_get_nearest_size bug

Nicolas Dufresne
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. https://bugzilla.gnome.org/show_bug.cgi?id=604434
seems slightly similar.

https://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer

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: [hidden email]
> Phone: +55 41 99152915
> _______________________________________________
> gstreamer-devel mailing list
> [hidden email]
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: gst-plugins-good: gst_v4l2_object_get_nearest_size bug

Henrique Camargo
In reply to this post by Henrique Camargo
My co-worker Diogo Luvizon filed the bug report and attached a patch
that fixes the problem.

You can find it in: https://bugzilla.gnome.org/show_bug.cgi?id=685209

Thank you for the information and fast response!

On Sat, Fri, 28 Sep 2012 at 16:34:43,  Nicolas Dufresne
<[hidden email]> 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. https://bugzilla.gnome.org/show_bug.cgi?id=604434
> seems slightly similar.
>
> https://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer
>
> 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: [hidden email]
Phone: +55 41 99152915
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel