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 604434 - v4l2src: errors when trying to set an unsupported pixelsize while it knows what the device supports
v4l2src: errors when trying to set an unsupported pixelsize while it knows wh...
Status: RESOLVED NOTGNOME
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
unspecified
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-12-13 09:06 UTC by Filippo Argiolas
Modified: 2014-12-09 21:13 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Filippo Argiolas 2009-12-13 09:06:28 UTC
Sorry for the contorted bug title :P
The issue, if it issue it really is, happens when you have a device that doesn't support framesize enumeration. v4l2src tries to get maximum and minimum supported framesize and sets int range caps. But it can happen that the device doesn't actually support a continuous range of framesizes and when you set an unsupported one v4l2src errors with something like:
0:00:01.954511990 23359  0xa25ff70 WARN                    v4l2 gstv4l2object.c:1928:gst_v4l2_object_set_format:<video_source> error: Device '/dev/video1' cannot capture at 642x480
0:00:01.954548657 23359  0xa25ff70 WARN                    v4l2 gstv4l2object.c:1928:gst_v4l2_object_set_format:<video_source> error: Tried to capture at 642x480, but device returned size 640x480

So, my question is, given that the device correctly reports the nearest supported framesize isn't there a way for v4l2src to update its caps and continue playing with that framesize instead of error out?

If you want to manually test this behaviour just "modprobe vivi" and try to set an unsupported cap like the 642x480.
Comment 1 Sebastian Dröge (slomo) 2011-05-23 14:24:51 UTC
v4l2src could check if downstream supports the suggested width/height too and then switch to that instead of erroring out. Want to provide a patch?
Comment 2 Julien Isorce 2013-12-31 10:50:46 UTC
Do you mean that if you set a caps filter it will override it ? Because if the user set 642x480 because gstv4l2src declared it supports 642x480 whereas it actually does not support it. Then I think it's correct to fail.

Here I think we want that gstv4l2src does not announce 642x480. But is it reasonable to test each possible size (when going from ready to paused. Maybe probing and cache it ? ) ?

But I think it makes senses when we do not force a very exact frame size, i.e. in gstv4l2src::fixate(), we set a size but it should maybe try another one if it fails because of bad announcement.

On kernel 3.11, gst-launch-1.0 v4l2src device=/dev/video1 ! videoconvert ! ximagesink  works (it selected 1920x500 because in caps it declares only precise framesizes).
But on kernel 3.4, it fails because only a framesize range is set in caps so fixate only try 320x200.

So it seems they fixed vivi in recent kernel so it confirms it was actually more a problem from the driver side.

About checking downstream, maybe it has been added since date of comment #1, see around "gst_pad_peer_query_caps" http://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/sys/v4l2/gstv4l2src.c#n320 

If there is anything left to do here, could you explain how to do that ? Thx
Comment 3 Nicolas Dufresne (ndufresne) 2014-03-29 20:25:44 UTC
Indeed, stepwise was introduced to represent ranges with steps. Though, from discussion with v4l2 kernel maintainers, it is likely that HW should always round up, rather then round nearest.

By rounding up, we could simply crop the output to fit the negotiated size, without having to care about the HW restriction.

We could also deal with stepwise without having to create large caps, since we could expose them as range, remembering the steps ranges, and doing the rounding up ourself. Steps are usually between 2 and 16.

Would that be an acceptable solution ?
Comment 4 Nicolas Dufresne (ndufresne) 2014-05-08 20:17:38 UTC
The new work partially support this now. If the v4l2 driver round up, it works, if it rounds down there is nothing we can do about it. I'm going to propose a kernel fix for that, let's see what they think of doing a round up, always, which seems more useful.
Comment 5 Nicolas Dufresne (ndufresne) 2014-10-29 20:01:37 UTC
Re-reading this give me an impression of being off from the origin report. Filippo, would it be possbile to provide a gst-launch like pipeline representing what you are doing ?
Comment 6 Nicolas Dufresne (ndufresne) 2014-12-09 21:13:52 UTC
I'm thinking this isn't really our bug. The driver should better report what it support, and then we would not be in the situation. If driver can report the correct size on S_FMT, it can most likely report it through the FRAME enumeration mechanism.