GNOME Bugzilla – Bug 677698
PATCH: camerabin: Set src_filter and zoom_src_filter caps while creating the pipeline
Last modified: 2012-10-21 13:24:04 UTC
Created attachment 215939 [details] [review]
gstcamerabin: Fix spelling error in debug logging
We (Fedora) have been receiving bug reports for cheese, about cheese taking 30-60 seconds before showing video, and pausing the same amount of time when changing the resolution for example.
I've managed to reproduce this with a Logitech Webcam Pro 9000, which supports a large list of resolutions at about 5 different framerates / resolution, in my case with an unmodified gst-plugins-bad-0.10.23, the camerabin_create_src_elements function takes approx 7 seconds.
Running under gdb and interrupting the execution during these 7 seconds consistenly points to gst_caps_intersect_full.
Part of the problem is cheese setting the GST_CAMERABIN_FLAG_SOURCE_COLOR_CONVERSION flag, which means that after the first ffmpegcsp element in the pipe the total number of caps is
x resolutions * y framerates * z formats, where both x (due to the camera) and z (due to ffmpegcsp) being large. intersecting this with the capabilities of other parts of the pipeline simply leads to an explosion of combinations which pegs my core i5 CPU @3.1GHz for 7 seconds!
This patch-set fixes this issue by setting up the capsfilter elements in the pipe with an initial filter, greatly reducing the number of combinations when doing cap intersecting.
This reduces the time spend in camerabin_create_src_elements from approx 7 to 0.2 seconds. And when patching cheese to use the default camerabin flags, (so removing the first ffmpegcsp element) from approx 0.7 to 0.04 seconds .
This patch set consists of 4 patches, the first one fixes an unrelated spelling error I noticed while working on this, 2 and 3 are preparation patches and 4 contains the actual fix.
Created attachment 215940 [details] [review]
camerabin: Add a camerabin_create_view_finder_caps() helper function
Created attachment 215941 [details] [review]
camerabin: Add gst_camerabin_get_video_source_properties() helper function
Created attachment 215942 [details] [review]
camerabin: Set src_filter and zoom_src_filter caps while creating the pipeline
These patches are against the 0.10 branch, but likely apply to master too. Also I'm not familiar with camerabin2, but the same issue may exist there.
Sorry, but the old camerabin1 is not really maintained any longer, it's been replaced by camerabin2 (which is 'camerabin' in 1.0) ages ago, and since there's unlikely to be another 0.10.x release, I think it's best to just close this.
The caps explosion thing is hopefully fixed in 1.0.