Synchronization in dynamic pipelines

I’m trying to use gstreamer to create a playout system for a radio station. Essentially I’m trying to create a pipeline from many filesrc elements that are offset in time via a pad offset.

The sources are custom manager bins, containing a filesrc, decodebin and some filter elements. They are added over time with a rolling window of 1 hour. Depending on the length of the files this means that there are 1-n of these present in the pipeline at any given time. Each of them is offset to it’s desired starting point in time.

The problem I’m currently facing is that when the audio is long and must start before the current time (with a negative offset), I get a timeout on the shout2send. The reason for this is that the sink is not prerolled anymore and the mixer blocks and waits for the buffer with the correct offset.

What is the correct way to add the element, so that the downstream elements don’t need to block as long? I have no problem with playing silence until the playback is at the correct position, but timing out must not happen.

I’m not sure if I understand the problem correctly but it sounds to me like you might want to switch the audiomixer into so-called “live mode”.

In recent GStreamer versions (1.22 and later) you can do that by setting the force-live=true property, and you will probably also want to set the min-upstream-latency property to something non-0 then, although I’m not sure if it will matter for your particular use case.

In “live mode” the audiomixer will always output, even if none of the inputs produce any data yet.

This is particularly useful for a playout type application where you might want to start with an audiomixer and just silence and then hook up inputs only after the pipeline is started.

In older GStreamer versions people have had an audiotestsrc is-live=true wave=silence branch feed into the audiomixer to force it into live mode, but with the new property that’s not needed any more.

Having said that, I’m not sure why it wouldn’t preroll in your case where the input is not live, I would’ve expected the mixer to just drop everything until the right offset is reached and then output that.