GNOME Bugzilla – Bug 375476
v4l2src cannot close /dev/video0
Last modified: 2006-11-18 18:15:45 UTC
Please describe the problem:
When a v4l2src element is set to NULL state, it should close the video device (typically /dev/video0). It does not.
Steps to reproduce:
0. Make sure there's some kind of v4l2 device attached to the PC so that /dev/video0 exists
1. Start a python interpreter
2. 'myv4l2srcelement = gst.element_factory_make('v4l2src')
This error message is shown:
GStreamer-CRITICAL **: Failed to deactivate pad v4l2src0:src, very bad
... and furthermore, /dev/video0 is not closed. (Creating another v4l2src element and trying to set *that* element into PAUSED state will fail because of this.)
No error message and a closed /dev/video0
Does this happen every time?
I have sent an email to gstreamer-devel about this what contains a program which displays the bug, but that program is larger than it needs be and the above procedure shows the presence of the bug just as well.
Could you create a full debug log?
$ export GST_DEBUG_NO_COLOR=1
$ GST_DEBUG=*:5 python test.py 2>dbg.log
$ gzip dbg.log
and then attach dbg.log.gz?
Probably unrelated, but I wonder if there are brackets missing in gst_v4l2src_capture_deinit(), line 640-644 - it seems to me that try_reinit should only be set to TRUE if the ioctl failed.
Created attachment 76632 [details]
Here you go. The ugly stuff seems to happen around line 43620. (Or search for the string "deinitting".)
I agree with #1 about the missing brackets - both that they seem to be missing and that it probably doesn't fix this bug to add them, becuase the ioctl *does* fail here.
I just comit to cvs....could you please update you source/compile and test it again.
I can confirm that CVS rev. 1.48 of v4l2src_calls.c fixes this problem. Setting to FIXED.
Since I am the reporter I can also VERIFY that this bug is now gone.
Also fixed the brackets:
2006-11-18 Tim-Philipp Müller <tim at centricular dot net>
* sys/v4l2/v4l2src_calls.c: (gst_v4l2src_capture_deinit):
Add missing curly brackets.