GNOME Bugzilla – Bug 746436
tee: Add property that allows having all source pads unlinked
Last modified: 2015-03-26 09:47:42 UTC
Created attachment 299791 [details] [review] tee: Add allow-not-linked property Attaches is a patch that implements that property
It is not a good idea in general, things like: videotestsrc ! tee Would just consume 100% cpu for nothing. The idea of the not-linked error is to make sure the pipeline doesn't keep on going when there is nothing to do.
Yes, I know that. This is why I added a property, for this to be optional. We are developing applications that are linking and unlinking elements to tee while in PLAYING state and it's hard otherwise to take care of not letting the tee completely disconnected for a while. As we are working with live pipelines this won't consume 100% of CPU. Nevertheless, what I'm forced to do now is this: videotestsrc ! tee ! fakesink That could also take 100% of CPU and requires more elements.
And the fakesink is also going to cause additional overhead that is generally not needed. Of course one can add/remove the fakesink dynamically, but that complicates the code very much.
Review of attachment 299791 [details] [review]: ::: tests/check/elements/tee.c @@ +670,3 @@ + src2 = gst_element_get_request_pad (tee, "src_%u"); + + fail_unless (gst_pad_push (srcpad, gst_buffer_ref (buffer)) == GST_FLOW_OK); Shouldn't it return GST_FLOW_OK only if there is no source pad at all, but if there is at least one and it returns GST_FLOW_NOT_LINKED that should be returned instead?
Review of attachment 299791 [details] [review]: ::: tests/check/elements/tee.c @@ +670,3 @@ + src2 = gst_element_get_request_pad (tee, "src_%u"); + + gst_pad_set_active (srcpad, TRUE); This behavior is intentional, because if you created a pad and before you link it a buffer arrives you will also have an error and that's exactly what I try to avoid with this property. The documentation of the property is this: "Return GTS_FLOW_OK even if there are not source pads or all are unlinked"
Makes sense, as you have no way to block the srcpad before you requested it without first blocking the sinkpad (and the complete tee). So there's always some time when the srcpad can return NOT_LINKED.
I had a use case for that as well at some point, e.g. if one wants to be able to suppress a GST_FLOW_ERROR from one branch (and remove/restart the branch without affecting the rest of the pipeline). I'm wondering if it wouldn't be better to do this on a per-srcpad basis rather than a global property though?
Well, I guess that's a different use case than yours then, because you can't set anything on the pads if there are not pads of course :)
Also you want to ignore *errors*, this here is only about ignoring tee not being linked downstream which can easily happen in dynamic pipelines :) I think those two things are complimentary. What do people think about getting this merged for now, and then if someone has a need for it again to add a "always-ok" property to the pads that will allow to ignore errors? I can see how that would also be interesting and useful, i.e. when you don't want a branch of a tee to shut down the whole thing.
Any more comments on this? Should I modify something?
> What do people think about getting this merged for now I'm fine with that. Only quibble I have is that there's no gtk-doc blurb documenting that the property is only 'Since: 1.6'.
Created attachment 300339 [details] [review] tee: Add allow-not-linked property Attached documentation to notice that the property is only available since 1.6
commit 3e8e0a7065410cd161b05133ac79b57118dd14c2 Author: Jose Antonio Santos Cadenas <santoscadenas@gmail.com> Date: Thu Mar 19 10:36:11 2015 +0100 tee: Add allow-not-linked property This property avoids not linked error when all the pads are unlinked or when there are no source pads. This is useful in dynamic pipelines where it can happen that for a short time there are no pads at all or all downstream pads are not linked yet. https://bugzilla.gnome.org/show_bug.cgi?id=746436