After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 685209 - gst_v4l2_object_get_nearest_size VIDIOC_G_FMT bug
gst_v4l2_object_get_nearest_size VIDIOC_G_FMT bug
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Linux
: Normal normal
: 1.0.7
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-10-01 12:44 UTC by Diogo Carbonera Luvizon
Modified: 2013-04-24 14:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
This patch corrects the bug setting the v4l2object->type to prevfmt.type before the G_FMT ioctl. (1.49 KB, patch)
2012-10-01 12:44 UTC, Diogo Carbonera Luvizon
none Details | Review

Description Diogo Carbonera Luvizon 2012-10-01 12:44:41 UTC
Created attachment 225484 [details] [review]
This patch corrects the bug setting the v4l2object->type to prevfmt.type before the G_FMT ioctl.

The function gst_v4l2_object_get_nearest_size 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 G_FMT 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.
Comment 1 Wim Taymans 2013-04-24 14:04:07 UTC
Thanks!

commit 0a7d4afc1bbda9d1d8fca51e3a68dc84ed998c71
Author: Diogo Carbonera Luvizon <diogo.luvizon@ensitec.com.br>
Date:   Mon Oct 1 09:29:21 2012 -0300

    v4l2: save the format correctly
    
    If TRY_FMT is not implemented,  gst_v4l2_object_get_nearest_size will
    use S_FMT and will change the device's operation mode. To save the
    old device mode we need to set the type field or else it will fail
    to save the previous format.
    
    Fixes https://bugzilla.gnome.org/show_bug.cgi?id=685209