GNOME Bugzilla – Bug 685209
gst_v4l2_object_get_nearest_size VIDIOC_G_FMT bug
Last modified: 2013-04-24 14:04:16 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.
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