GNOME Bugzilla – Bug 649067
v4l2src: got unexpected frame size of 262254 instead of 614400
Last modified: 2011-09-30 09:45:47 UTC
I start Cheese and this error comes up. ** (cheese:5852): WARNING **: Internal GStreamer error: clock problem. Please file a bug at http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer. ** (cheese:5852): WARNING **: Got unexpected frame size of 262254 instead of 614400. ** (cheese:6130): WARNING **: Error reading 614400 bytes on device '/dev/video0'. ** (cheese:6130): WARNING **: Internal data flow error. Sometimes I can see it in black and white and most of the time it's only a black screen. The same thing happens on Skype. I am using a MacBook 3,1 with the isight.fw firmware. Camera output works fine with mplayer.
This bug (clock error) should be fixed in the upcoming -bad release/pre-release (if you're using ubuntu, try the GStreamer PPA). See http://blog.fujii.eti.br/?p=104 *** This bug has been marked as a duplicate of bug 640637 ***
I tried the patch with gst-plugins-bad and unfortunately still get the same error with the unexpected frame size. Are there any other solutions I can try? (In reply to comment #0) > I start Cheese and this error comes up. > > > ** (cheese:5852): WARNING **: Internal GStreamer error: clock problem. Please > file a bug at http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer. > > > ** (cheese:5852): WARNING **: Got unexpected frame size of 262254 instead of > 614400. > > > ** (cheese:6130): WARNING **: Error reading 614400 bytes on device > '/dev/video0'. > > > ** (cheese:6130): WARNING **: Internal data flow error. > > > Sometimes I can see it in black and white and most of the time it's only a > black screen. > > The same thing happens on Skype. > > I am using a MacBook 3,1 with the isight.fw firmware. > > Camera output works fine with mplayer.
Could you make a GST_DEBUG=*:5 log like this then please? $ GST_DEBUG=*:5 cheese 2>dbg.log ... reproduce error/problem, then quit or control-C ... $ bzip2 dbg.log and attach dbg.log.bz2?
Created attachment 187035 [details] Cheese debug log Thanks for all the help. Hopefully this helps more people than just me.
Uploaded debug log. Switched from Gnome 3 PPA in Ubuntu to Fedora 15 Beta and still have the same error. Skype won't initialize camera either.
> Skype won't initialize camera either. In that case it's most likely a driver issue..
I've gotten the camera to work with the same drivers before on previous Ubuntu versions. Just tested the camera with mplayer and it works perfect. Also tested it with Google Voice and Video Chat. Works great. Also, with the voice and Video Chat Empathy plugin, works well, but with some stammering. Again, all this was tested on the Fedora 15 Beta. Also all the same results on the Gnome-Team PPA Ubuntu 11.04
Well, it's possible that it only happens with some formats, but not with others (and different apps negotiate to different formats). And it could also be a libv4l bug. Just speculating though, haven't looked at the log yet.
I am getting the same problem with 0.10.27 or greater on Fedora 15 on a Macbook 2,1 with an isight camera, which uses the uvcvideo driver. 0.10.26 from Fedora 14 works fine if I downgrade. Custom 0.10.27 packages 0.10.28, as well as the 0.10.29 package that ships Fedora 15 all do not work properly. I was able to work around it by doing the following with 0.10.29: diff -uNr gst-plugins-good-0.10.29/sys/v4l2/gstv4l2object.c gst-plugins-good-0.10.29-fixed/sys/v4l2/gstv4l2object.c --- gst-plugins-good-0.10.29/sys/v4l2/gstv4l2object.c 2011-03-08 06:34:55.000000000 -0500 +++ gst-plugins-good-0.10.29-fixed/sys/v4l2/gstv4l2object.c 2011-06-04 23:59:31.040616435 -0400 @@ -1504,9 +1504,9 @@ gint int_height = height; /* interlaced detection using VIDIOC_TRY/S_FMT */ - if (!gst_v4l2_object_get_nearest_size (v4l2object, pixelformat, - &int_width, &int_height, &interlaced)) - return NULL; + //if (!gst_v4l2_object_get_nearest_size (v4l2object, pixelformat, + // &int_width, &int_height, &interlaced)) + // return NULL; memset (&ival, 0, sizeof (struct v4l2_frmivalenum)); ival.index = 0;
Thank you Jason. I just wish I knew what that meant. Could you show me how to use the workaround or downgrade the driver? Which is better overall? (In reply to comment #9) > I am getting the same problem with 0.10.27 or greater on Fedora 15 on a Macbook > 2,1 with an isight camera, which uses the uvcvideo driver. 0.10.26 from Fedora > 14 works fine if I downgrade. Custom 0.10.27 packages 0.10.28, as well as the > 0.10.29 package that ships Fedora 15 all do not work properly. > > I was able to work around it by doing the following with 0.10.29: > > diff -uNr gst-plugins-good-0.10.29/sys/v4l2/gstv4l2object.c > gst-plugins-good-0.10.29-fixed/sys/v4l2/gstv4l2object.c > --- gst-plugins-good-0.10.29/sys/v4l2/gstv4l2object.c 2011-03-08 > 06:34:55.000000000 -0500 > +++ gst-plugins-good-0.10.29-fixed/sys/v4l2/gstv4l2object.c 2011-06-04 > 23:59:31.040616435 -0400 > @@ -1504,9 +1504,9 @@ > gint int_height = height; > > /* interlaced detection using VIDIOC_TRY/S_FMT */ > - if (!gst_v4l2_object_get_nearest_size (v4l2object, pixelformat, > - &int_width, &int_height, &interlaced)) > - return NULL; > + //if (!gst_v4l2_object_get_nearest_size (v4l2object, pixelformat, > + // &int_width, &int_height, &interlaced)) > + // return NULL; > > memset (&ival, 0, sizeof (struct v4l2_frmivalenum)); > ival.index = 0;
Unfortunately I'm still having the same issue with the patch worked into the package. Maybe I'll have to break down and try a reinstall with the 64 bit. Hopefully this patch can get worked into the next build. Maybe I'm just not doing it right.
Jason's patch works. This should get worked into the next release.
Created attachment 189427 [details] [review] diff patch I have no idea if I typed up the patch correctly but I'm sure someone will figure it out.
So the patch is a workaround, but as to what is actually the problem, I wonder if this may be related: https://bugzilla.kernel.org/show_bug.cgi?id=36152
Haven't tested but the commit that introduced that was commit 351ac548228ec91fe3d73ee07c5a4e1618559e9d Author: Janne Grunau <janne.grunau@collabora.co.uk> Date: Thu Nov 4 18:36:09 2010 +0100 v4l2src: check field information and set interlaced caps accordingly Reject the format if the field type is not supported. https://bugzilla.gnome.org/show_bug.cgi?id=634391 But the kernel bug link seems to be the real problem, the test case there triggers the bug for my isight.
As inconvenient as it is, it should probably be fixed in the kernel driver then (not that it helps anyone, but it works fine with my MBP's iSight, so doesn't seem to be a general problem)
Comment on attachment 189427 [details] [review] diff patch Don't think this patch is acceptable, unless what the code does is clearly wrong (which I don't think is the case - please correct me if I'm mistaken). A work-around that doesn't revert functionality for correctly-implemented drivers might be acceptable though if it's not too intrusive.
Created attachment 193399 [details] [review] v4l2: take care not to change the current format where appropriate Some drivers are buggy are will change the current format when processing VIDIOC_TRY_FMT. Save and restore the current format to ensure the format is kept unchanged.
This might help: it saves the current format and restores it after the operation. It might or might not incur an extra delay for some hardware. It's not really tested as v4l2src works for me in the first place, but it still works with the patch. I note that the implementation of gst_v4l2_object_get_nearest_size uses VIDIOC_S_FMT if VIDIOC_TRY_FMT fails, so it looks like this patch might be needed for all drivers anyway. If someone with a problematic driver can test, that'd be great.
Does it help? I've pushed this change in any case because it seems to be necessary anyway and shouldn't cause any problems. commit 639abf01f94cf13ef4173e502c80a8a40b9e755d Author: Vincent Penquerc'h <vincent.penquerch@collabora.co.uk> Date: Mon Aug 8 10:54:26 2011 +0100 v4l2: take care not to change the current format where appropriate Some drivers are buggy are will change the current format when processing VIDIOC_TRY_FMT. Save and restore the current format to ensure the format is kept unchanged.
Setting to NEEDINFO, to see whether this patch fixes the original reporter's issue, since I'm not having that problem so could only fix blind.
Ben: ping?
Fixed for me. I had this same issue on both Fedora 15 and Ubuntu 11.04--I'm the one who reported the bug at kernel.org. Using gstreamer-plugins-good from git, which includes the above patch, it works fine. Obviously it should still be fixed in v4l once someone figures out what exactly is going on. But for now, it's great to have a workaround for all the gstreamer clients. Thanks!
Thanks for confirming.