How to operate "valve" element

bb bb.bills at
Mon Feb 24 22:50:11 UTC 2020


I find the 'valve' element confusing in spite its seemingly simple
I got a simple filesrc -> valve -> appsink pipeline and am trying to use the
valve to control the flow. Initially the valve is open and all is good. When
the "drop" property is set to TRUE the new samples stop arriving as
expected. Now if the "drop" is set to FALSE again I don't get any new
samples; i find it counterintuitive.

In an attempt to get this working (e.g. getting samples flowing each time
the valve is open, regardless of the previous state) I was setting the
appsink state to GST_STATE_PAUSED whenever valve "drop" is TRUE and to
GST_STATE_PLAYING when valve "drop" is FALSE. That worked better as appsink
is getting new samples whenever the valve is open, however the samples
received on the valve reopen are those that were meant to to be dropped
while the valve was closed as if they were buffered up and are now being
pushed to appsink as nothing happened. Is that how it's meant to work? I was
expecting the samples dropped during valve "drop" == true to be lost
forever, never reaching the appsink.

Searching on the web i noticed people suggest setting the sink's "async"
property to FALSE but that didn't do anything for me.

Clearly in this simple pipeline I could be controlling the samples within
appsink "new-sample" callback but i'm intending to use valve elsewhere and
would like to know how to operate it correctly - as it is looks like i'm
missing something.

Sent from:

More information about the gstreamer-devel mailing list