Handling branches with different latencies

Tim Müller tim at centricular.com
Mon Nov 27 10:19:47 UTC 2017


On Sun, 2017-11-26 at 23:09 -0700, Baby Octopus wrote:

Hi,

> I have a tricky pipeline which has two branches
> 
> src ! tee name=splitter \
> splitter.! queue ! x264enc tune="zerolatency" ! sink1
> splitter.! queue ! x264enc ! sink2
> 
> I want the first branch to have minimal latency. But both the
> branches seem to take max latency of 2nd branch. Is there a way to
> handle each branch to operate in its least latency and other branches
> not affect it?
> 
> This may be worked around by setting negative ts-offset in sink1. Is
> there a better way of handling this?

Depends a bit on the details. Is this a live pipeline (what is the
source element) or not?

If it's not a live pipeline and the source can produce data faster than
real time, then the solution is to make the queue before the encoder in
the second branch larger, like

  queue max-size-time=5000000000 max-size-buffers=0 max-size-bytes=0

By default the queue max size is ca. 1 second, and x264enc will consume
ca. 2-3 seconds of video before outputting anything, so that may
throttle the other branch (if it prerolls at all) because your queue in
branch 2 will run full and block.

If it's a live pipeline, then all sinks will configure to the MAX of
all the sinks' min latencies. I don't think you can override that in
gst-launch, but you can in code e.g. by sending latency events.

Cheers
 -Tim


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


More information about the gstreamer-devel mailing list