GNOME Bugzilla – Bug 591451
[v4l2] causes hanging stream when VIDIOC_G_PARM is not supported
Last modified: 2009-08-14 12:32:02 UTC
Hi, I've been debugging this: https://bugzilla.redhat.com/show_bug.cgi?id=467961 A little (and yes it still happens with up2date everything), the problem is that the pwc driver does not support the VIDIOC_G_PARM call, which results in gv4l2src_calls.c: st_v4l2src_set_capture() not setting v4l2src-> fps_n / fps_d, so they stay 0. However gstv4l2src.c: gst_v4l2src_create() calls gst_util_uint64_scale_int() using v4l2src->fps_n / fps_d unconditionally. This causes cheese, which uses the following pipeline: v4l2src name=video_source device=/dev/video1 ! capsfilter name=capsfilter caps=video/x-raw-rgb,width=640,height=480,framerate=15/1;video/x-raw-yuv,width=640,height=480,framerate=15/1 ! identity To hang, while filling the terminal it was started from with: (cheese:5273): GStreamer-CRITICAL **: gst_util_uint64_scale_int: assertion `denom > 0' failed (cheese:5273): GStreamer-CRITICAL **: gst_util_uint64_scale_int: assertion `denom > 0' failed (cheese:5273): GStreamer-CRITICAL **: gst_util_uint64_scale_int: assertion `denom > 0' failed The attached patch fixes this by making the substraction of the latency from the timestamp conditional.
Created attachment 140441 [details] [review] PATCH: v4l2 plugin causes hanging stream when VIDIOC_G_PARM is not supported
Hrm, that's bad. Guess we should be doing something about this before the release, so marking as blocker for now. I presume the 'hang' was caused by all buffers being timestamped with a timestamp of 0 (which then get dropped by the sink)?
(In reply to comment #2) > I presume the 'hang' was caused by all buffers being timestamped with a > timestamp of 0 (which then get dropped by the sink)? > Yes I think so, I didn't investigate further, fixing the timestamp generation code to work when we have no known framerate fixes things.
Committed, thanks: commit 10d41286d5bf738a8a7f7537682958b085990e86 Author: Hans de Goede <jwrdegoede@fedoraproject.org> Date: Fri Aug 14 12:44:06 2009 +0100 v4l2src: fix 'hang' with some cameras caused by bad timestamping if no framerate is available For cameras/drivers that don't support e.g. VIDIOC_G_PARM we'd end up without a framerate and would try to divide by 0, causing run-time warnings and all frames to be timestamped with 0, which makes sinks that sync against the clock drop them, causing 'hangs' (observed with the pwc driver and a Logitech QuickCam Pro 4000). So if we do not know the framerate, simply don't adjust the timestamps. Fixes #591451.