GNOME Bugzilla – Bug 736926
dshowvideosrc: error if set_caps is called while running
Last modified: 2014-09-24 07:03:03 UTC
Created attachment 286533 [details] [review] suggested patch to allow set_caps to be called multiple times I have a pipeline using dshowvideosrc which calls set_caps while it is already running, resulting in the error "At least one of the pins involved in the operation is already connected", VFW_E_ALREADY_CONNECTED. So it seems simply calling media_filter->Stop() is not enough. This patch checks if the new caps are the same, returning immediately, otherwise it disconnects the pins before reconnecting. Not sure if it's better to reconfigure the existing connection, or if that's even possible.
Is there a sure way to reproduce this ? Never happened to me... Anyway, the patch looks fine to me, but the same thing should probably be done for the audio capture.
Review of attachment 286533 [details] [review]: Yes, should be done for the audio source too. Looks mostly good though ::: sys/dshowsrcwrapper/gstdshowvideosrc.cpp @@ +582,3 @@ + GstCaps *current_caps = gst_pad_get_current_caps (pad); + gst_object_unref (pad); + gboolean same_caps = gst_caps_is_strictly_equal (caps, current_caps); Put all the variable declarations at the beginning of the block, also a simple gst_caps_is_equal() is enough here :)
Created attachment 286933 [details] [review] moved decls up and did this for audiosrc as well Implemented your suggestions, though my app doesn't use audio so that hasn't been tested yet.
commit 27eb6555d19ab2496cc35273bc54e89dfc0b9977 Author: Joshua M. Doe <oss@nvl.army.mil> Date: Thu Sep 18 16:13:58 2014 -0400 dshowsrcwrapper: avoid error when set_caps called twice If set_caps is called in a running state, return immediately if the caps haven't changed. If the pins are already connected, disconnect them. https://bugzilla.gnome.org/show_bug.cgi?id=736926