Push source scheduling and the create function

Tim Müller tim at centricular.com
Fri Apr 29 19:19:35 UTC 2016

On Fri, 2016-04-29 at 08:53 -0700, Martin Kelly wrote:

Hi Martin,

> Case 1:
> - create one pipeline
> - use gst_bin_add_many to add many bins to it
> - the first bin is of the form "some-video-element ! [encode and
> many 
> other elements] udpsink"
> - all other bins are in the form "my-push-src ! fakesink"
> - set the pipeline to playing
> Case 2:
> - create one pipeline per bin via gst_pipeline_new + gst_bin_add
> - the first pipeline is of the form "some-video-element ! [encode
> and many other elements] udpsink"
> - set each pipeline to playing
> In both cases, I see the video element playing correctly. In case 1,
> I'm  seeing that the create function in "my-push-src" is being called
> once  for each push source and never being called again. In case 2,
> create  continually gets called, and everything seems OK. It seems
> that somehow  the scheduling is different between cases 1 and 2, and
> I'm guessing the  video element's scheduling is somehow changing that
> of the push source elements.

What kind of source is "video-element" ? Is it a live capture source
such as v4l2src or such?

Is it possible there is something missing in your description of Case
2? I assume it's the same as Case 1 just everything in separate
pipelines instead of separate bins in a single pipeline?

Possibly the difference is related to the "preroll" mechanism we have
in GStreamer. Basically, at least in a non-live pipeline sinks will
block when they receive the first buffer, and only when *all* sinks in
a pipeline have received a first buffer. If just one sink does not
receive a buffer, all the other sub-pipelines will be blocked/waiting.
I wonder if that's what you're seeing here. If you use separate
pipelines they all operate 100% independently of course.

Otherwise it's hard to see what's going on without more info. Perhaps
you could make a snapshot of the pipeline and dump it into a "dot
graph" to see which sinks are prerolled and which are not.

You can also set async=false on sinks if you know they may not get a
buffer immediately initially, but that should be rarely needed.


Tim Müller, Centricular Ltd - http://www.centricular.com

More information about the gstreamer-devel mailing list