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 649067 - v4l2src: got unexpected frame size of 262254 instead of 614400
v4l2src: got unexpected frame size of 262254 instead of 614400
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
0.10.27
Other Linux
: Normal major
: 0.10.31
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-05-01 06:46 UTC by Ben
Modified: 2011-09-30 09:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Cheese debug log (599.06 KB, application/x-bzip)
2011-05-02 13:42 UTC, Ben
  Details
diff patch (759 bytes, patch)
2011-06-07 19:44 UTC, Ben
rejected Details | Review
v4l2: take care not to change the current format where appropriate (2.82 KB, patch)
2011-08-08 09:56 UTC, Vincent Penquerc'h
committed Details | Review

Description Ben 2011-05-01 06:46:10 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.
Comment 1 Tim-Philipp Müller 2011-05-01 12:42:35 UTC
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 ***
Comment 2 Ben 2011-05-02 08:50:36 UTC
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.
Comment 3 Tim-Philipp Müller 2011-05-02 09:18:08 UTC
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?
Comment 4 Ben 2011-05-02 13:42:31 UTC
Created attachment 187035 [details]
Cheese debug log

Thanks for all the help. Hopefully this helps more people than just me.
Comment 5 Ben 2011-05-06 14:02:18 UTC
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.
Comment 6 Tim-Philipp Müller 2011-05-06 14:19:35 UTC
> Skype won't initialize camera either.

In that case it's most likely a driver issue..
Comment 7 Ben 2011-05-06 14:25:28 UTC
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
Comment 8 Tim-Philipp Müller 2011-05-06 14:32:17 UTC
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.
Comment 9 Jason 2011-06-05 04:27:41 UTC
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;
Comment 10 Ben 2011-06-05 18:38:06 UTC
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;
Comment 11 Ben 2011-06-07 05:18:33 UTC
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.
Comment 12 Ben 2011-06-07 19:40:16 UTC
Jason's patch works. This should get worked into the next release.
Comment 13 Ben 2011-06-07 19:44:34 UTC
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.
Comment 14 Jason 2011-06-07 19:55:54 UTC
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
Comment 15 Diego Escalante Urrelo (not reading bugmail) 2011-07-14 19:19:46 UTC
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.
Comment 16 Tim-Philipp Müller 2011-07-14 19:31:32 UTC
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 17 Tim-Philipp Müller 2011-07-14 19:36:53 UTC
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.
Comment 18 Vincent Penquerc'h 2011-08-08 09:56:38 UTC
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.
Comment 19 Vincent Penquerc'h 2011-08-08 09:59:14 UTC
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.
Comment 20 Sebastian Dröge (slomo) 2011-08-09 07:54:44 UTC
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.
Comment 21 Vincent Penquerc'h 2011-08-23 11:23:31 UTC
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.
Comment 22 Tim-Philipp Müller 2011-09-25 14:03:17 UTC
Ben: ping?
Comment 23 Dave Vasilevsky 2011-09-30 04:04:01 UTC
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!
Comment 24 Tim-Philipp Müller 2011-09-30 09:45:47 UTC
Thanks for confirming.