GNOME Bugzilla – Bug 706628
v4l2src hangs opening device
Last modified: 2014-08-27 18:07:08 UTC
I have 2 versions of gstreamer installed on my centos 6 box. xx.10, the default install works fine for gst-inspect v4l2src. I have done a full download of the 1.1.3 release (gstreamer,base,good...) sources and done a source build and installed into an independent directory. Everything else works fine, but v4l2src hangs. gst-inspect v4l2src prints everything up to device name, then hangs. ********************************************0.10... /usr/bin/gst-inspect-0.10 v4l2src Factory Details: Long name: Video (video4linux2) Source Class: Source/Video Description: Reads frames from a video4linux2 (BT8x8) device Author(s): Edgard Lima <edgard.lima@indt.org.br>, Stefan Kost <ensonic@users.sf.net> Rank: primary (256) Plugin Details: Name: video4linux2 Description: elements for Video 4 Linux Filename: /usr/lib64/gstreamer-0.10/libgstvideo4linux2.so Version: 0.10.23 License: LGPL Source module: gst-plugins-good Binary package: Fedora gstreamer-plugins-good package Origin URL: http://download.fedora.redhat.com/fedora GObject +----GstObject +----GstElement +----GstBaseSrc +----GstPushSrc +----GstV4l2Src Implemented Interfaces: GstURIHandler GstImplementsInterface GstTuner GstColorBalance GstVideoOrientation GstPropertyProbe Pad Templates: SRC template: 'src' Availability: Always Capabilities: video/x-raw-rgb bpp: 8 depth: 8 red_mask: 224 green_mask: 28 blue_mask: 3 endianness: 1234 width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw-rgb bpp: 16 depth: 15 red_mask: 31744 green_mask: 992 blue_mask: 31 endianness: 1234 width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw-rgb bpp: 16 depth: 16 red_mask: 63488 green_mask: 2016 blue_mask: 31 endianness: 1234 width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw-rgb bpp: 16 depth: 15 red_mask: 31744 green_mask: 992 blue_mask: 31 endianness: 4321 width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw-rgb bpp: 16 depth: 16 red_mask: 63488 green_mask: 2016 blue_mask: 31 endianness: 4321 width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw-rgb bpp: 24 depth: 24 red_mask: 255 green_mask: 65280 blue_mask: 16711680 endianness: 4321 width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw-rgb bpp: 24 depth: 24 red_mask: 16711680 green_mask: 65280 blue_mask: 255 endianness: 4321 width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw-rgb bpp: 32 depth: 32 red_mask: 255 green_mask: 65280 blue_mask: 16711680 endianness: 4321 width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw-rgb bpp: 32 depth: 32 red_mask: -16777216 green_mask: 16711680 blue_mask: 65280 endianness: 4321 width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw-gray bpp: 8 width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw-yuv format: YVU9 width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw-yuv format: YV12 width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw-yuv format: YUY2 width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw-yuv format: UYVY width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw-yuv format: Y42B width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw-yuv format: Y41B width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw-yuv format: Y41P width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw-yuv format: NV12 width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw-yuv format: NV21 width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw-yuv format: YUV9 width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw-yuv format: I420 width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw-bayer width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] image/jpeg width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] image/jpeg width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-dv systemstream: true width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/mpegts video/x-sonix width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-pwc1 width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-pwc2 width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw-yuv format: YVYU width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] Element Flags: no flags set Element Implementation: Has change_state() function: 0x7f05632f21a0 Has custom save_thyself() function: gst_element_save_thyself Has custom restore_thyself() function: gst_element_restore_thyself Element has no clocking capabilities. Element has no indexing capabilities. URI handling capabilities: Element can act as source. Supported URI protocols: v4l2 Pads: SRC: 'src' Implementation: Has getrangefunc(): gst_base_src_pad_get_range Has custom eventfunc(): gst_base_src_event_handler Has custom queryfunc(): gst_base_src_query Pad Template: 'src' Element Properties: name : The name of the object flags: readable, writable String. Default: null Current: "v4l2src0" blocksize : Size in bytes to read per buffer (-1 = default) flags: readable, writable Unsigned Long. Range: 0 - 18446744073709551615 Default: 4096 Current: 4096 num-buffers : Number of buffers to output before sending EOS (-1 = unlimited) flags: readable, writable Integer. Range: -1 - 2147483647 Default: -1 Current: -1 typefind : Run typefind before negotiating flags: readable, writable Boolean. Default: false Current: false do-timestamp : Apply current stream time to buffers flags: readable, writable Boolean. Default: false Current: false device : Device location flags: readable, writable String. Default: "/dev/video0" Current: "/dev/video0" device-name : Name of the device flags: readable String. Default: null Current: "BT878 video (Geovision GV-800(S" device-fd : File descriptor of the device flags: readable Integer. Range: -1 - 2147483647 Default: -1 Current: -1 flags : Device type flags flags: readable Flags "GstV4l2DeviceTypeFlags" Default: 0x00000000, "(none)" Current: 0x00000000, "(none)" (0x00000001): capture - Device supports video capture (0x00000002): output - Device supports video playback (0x00000004): overlay - Device supports video overlay (0x00000010): vbi-capture - Device supports the VBI capture (0x00000020): vbi-output - Device supports the VBI output (0x00010000): tuner - Device has a tuner or modulator (0x00020000): audio - Device has audio inputs or outputs queue-size : Number of buffers to be enqueud in the driver in streaming mode flags: readable, writable Unsigned Integer. Range: 1 - 16 Default: 2 Current: 2 always-copy : If the buffer will or not be used directly from mmap flags: readable, writable Boolean. Default: true Current: true ****************************** 1.1.3 version /opt/een/bin/gst-inspect-1.0 v4l2src Factory Details: Rank primary (256) Long-name Video (video4linux2) Source Klass Source/Video Description Reads frames from a Video4Linux2 device Author Edgard Lima <edgard.lima@indt.org.br>, Stefan Kost <ensonic@users.sf.net> Plugin Details: Name video4linux2 Description elements for Video 4 Linux Filename /opt/een/lib/gstreamer-1.0/libgstvideo4linux2.so Version 1.1.3 License LGPL Source module gst-plugins-good Source release date 2013-07-29 Binary package GStreamer Good Plug-ins source release Origin URL Unknown package origin GObject +----GInitiallyUnowned +----GstObject +----GstElement +----GstBaseSrc +----GstPushSrc +----GstV4l2Src Implemented Interfaces: GstURIHandler GstTuner GstColorBalance GstVideoOrientation Pad Templates: SRC template: 'src' Availability: Always Capabilities: video/x-raw format: RGB15 width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw format: RGB16 width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw format: BGR width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw format: RGB width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw format: BGRx width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw format: RGBx width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw format: GRAY8 width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw format: YVU9 width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw format: YV12 width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw format: YUY2 width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw format: UYVY width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw format: Y42B width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw format: Y41B width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw format: NV12 width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw format: NV21 width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw format: YUV9 width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw format: I420 width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-bayer width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] image/jpeg width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] image/jpeg width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] image/jpeg width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-dv systemstream: true width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/mpegts video/x-sonix width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-pwc1 width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-pwc2 width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] video/x-raw format: YVYU width: [ 1, 32768 ] height: [ 1, 32768 ] framerate: [ 0/1, 100/1 ] Element Flags: no flags set Element Implementation: Has change_state() function: 0x7f087407f5a0 Element has no clocking capabilities. Element has no indexing capabilities. URI handling capabilities: Element can act as source. Supported URI protocols: v4l2 Pads: SRC: 'src' Implementation: Has getrangefunc(): gst_base_src_getrange Has custom eventfunc(): gst_base_src_event Has custom queryfunc(): gst_base_src_query Has custom iterintlinkfunc(): gst_pad_iterate_internal_links_default Pad Template: 'src' Element Properties: name : The name of the object flags: readable, writable String. Default: "v4l2src0" parent : The parent of the object flags: readable, writable Object of type "GstObject" blocksize : Size in bytes to read per buffer (-1 = default) flags: readable, writable Unsigned Integer. Range: 0 - 4294967295 Default: 4096 num-buffers : Number of buffers to output before sending EOS (-1 = unlimited) flags: readable, writable Integer. Range: -1 - 2147483647 Default: -1 typefind : Run typefind before negotiating flags: readable, writable Boolean. Default: false do-timestamp : Apply current stream time to buffers flags: readable, writable Boolean. Default: false device : Device location flags: readable, writable String. Default: "/dev/video0" device-name : Name of the device and hangs there forever.
Could you run it in gdb and get a stack trace where it hangs? (threads apply all bt)
(In reply to comment #1) > Could you run it in gdb and get a stack trace where it hangs? (threads apply > all bt) (gdb) info threads * 1 Thread 0x7ffff7ce6700 (LWP 18059) 0x0000003834ae52d9 in syscall () from /lib64/libc.so.6 (gdb) backtrace
+ Trace 232415
This sounds like a bug in libv4l2 or the driver. Does this also happen if you compile gst-plugins-good without libv4l2?
it is using the same v4l2 library as the 0.10 release, and the same drivers, so I am not sure how that could really be the case. I erased the libv4l-devel package and got the same results. 0.10 is completely happy 1.1.3 hangs.
some more observations this is actually still running - the debug level five output dumped 25794769731 bytes of data before I got bored, and it was still running. The v4l2src is walking through a 32 bit value, one control at a time. Without debugging it is spinning at 100% for 10 minutes now. this clearly a bug. The get list loop is broken... This happens whether I am using libv4l2 or not and happens with both the 0.6 version and the 1.0 version of the v4l library. steve tail of the dump file... 0:24:58.384071989 20624 0x25b6a30 DEBUG v4l2 v4l2_calls.c:279:gst_v4l2_fill_lists:<v4l2src0> skipping control 00493f16 0:24:58.384080100 20624 0x25b6a30 DEBUG v4l2 v4l2_calls.c:262:gst_v4l2_fill_lists:<v4l2src0> checking control 00493f17 0:24:58.384088856 20624 0x25b6a30 DEBUG v4l2 v4l2_calls.c:279:gst_v4l2_fill_lists:<v4l2src0> skipping control 00493f17 0:24:58.384096971 20624 0x25b6a30 DEBUG v4l2 v4l2_calls.c:262:gst_v4l2_fill_lists:<v4l2src0> checking control 00493f18 0:24:58.384105701 20624 0x25b6a30 DEBUG v4l2 v4l2_calls.c:279:gst_v4l2_fill_lists:<v4l2src0> skipping control 00493f18 0:24:58.384113832 20624 0x25b6a30 DEBUG v4l2 v4l2_calls.c:262:gst_v4l2_fill_lists:<v4l2src0> checking control 00493f19 0:24:58.384127879 20624 0x25b6a30 DEBUG v4l2 v4l2_calls.c:279:gst_v4l2_fill_lists:<v4l2src0> skipping control 00493f19 0:24:58.384136467 20624 0x25b6a30 DEBUG v4l2 v4l2_calls.c:262:gst_v4l2_fill_lists:<v4l2src0> checking control 00493f1a 0:24:58.384151192 20624 0x25b6a30 DEBUG v4l2 v4l2_calls.c:279:gst_v4l2_fill_lists:<v4l2src0> skipping control 00493f1a 0:24:58.384159774 20624 0x25b6a30 DEBUG v4l2 v4l2_calls.c:262:gst_v4l2_fill_lists:<v4l2src0> checking control 00493f1b
Final piece of follow up. I let the gst-inspect v4l2src run overnight - after 300+ minutes of cpu usage, still running at 100% of a thread I gave up on 1.1.3. Removed the 1.1.3 build, replaced it with a source build of 1.0.9. v4l2src works fine. So this is clearly something in the list loop. steve
Indeed, can you check which part of that loop is used? Is V4L2_CTRL_FLAG_NEXT_CTRL defined for you? Also which of the exit cases should it take but doesn't? Should be relatively easy to step through that in gdb to see where it is supposed to exit the loop but does not.
Created attachment 266266 [details] [review] stab in the dark If you could also test this and see if that fixes it ?
Created attachment 266267 [details] [review] maybe fix Off by one. Updated.
Comment on attachment 266267 [details] [review] maybe fix Makes sense obviously, even if it does not fix this bug
I've been seeing the same behavior running my build from the 1.2.3 tag on Precise with a Sensoray 611 (Bt8xx chipset). Vincent's patch attached to this bug fixes that for me. I can now get v4l2src to play from that device.
Comment on attachment 266267 [details] [review] maybe fix I didn't reference this bug, as it's not fixing it. commit 4d0e1a4536e010ecfb48d40fcde65246d655c84b Author: Vincent Penquerc'h <vincent.penquerch@collabora.co.uk> Date: Tue Jan 14 14:48:42 2014 +0000 v4l2: attempt to fix infinite (for small version of infinite) loop
(In reply to comment #12) Would you consider pushing Vincent's fix to 1.2 branch as well? Would like it in the next 1.2 release (if there is one, I don't know the plan).
(In reply to comment #13) > (In reply to comment #12) > > Would you consider pushing Vincent's fix to 1.2 branch as well? Would like it > in the next 1.2 release (if there is one, I don't know the plan). Right, it didn't fix this particular bug but fixes a bug you have. I'll ref this bug this time, so we have some tracking.
Done. commit 00067d4749cbe36a2536e6cd42ad1008cbf6a499 Author: Vincent Penquerc'h <vincent.penquerch@collabora.co.uk> Date: Tue Jan 14 14:48:42 2014 +0000 v4l2: attempt to fix infinite (for small version of infinite) loop Related to https://bugzilla.gnome.org/show_bug.cgi?id=706628
Is this still an issue ?
Ping ?
I think this is obsolete now, a lot have been changed and address since this bug was reported.