Gapless playback with custom pipeline

Sebastian Dröge sebastian at
Thu Jun 26 01:00:14 PDT 2014

On Mi, 2014-06-11 at 04:05 -0400, David Griffin wrote:
> I need advice on how to implement gapless playback with a custom pipeline,
> meaning not playbin, playbin2 or something like those. I thought of using a
> queue, but if data of the next track is combined in the queue with data
> from the playing track, then I change what track is playing next, how would
> I remove data of the previous next track choice from the queue?
> I'm not set on using a queue. Any advice on how to implement this would be
> great. Doing it in a way that allows combining audio of two different
> codecs is preferable too.

Take a look at the code in playbin and streamsynchronizer. That's
basically what you'll have to do:
- wait for EOS of the first track
- switch to the second track at your "switch point" (the part of
  your pipeline that stays the same for all tracks and gets the
  input of the different tracks)
- make sure that running times of the stream are continuously
  increasing, which might require some segment adjustments

Of course you could already pre-roll the second track much earlier, just
it has to be blocked on its srcpad and you only can connect it to your
overall pipeline once the first track has finished.

Sebastian Dröge, Centricular Ltd -
Expertise, Straight from the Source
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: This is a digitally signed message part
URL: <>

More information about the gstreamer-devel mailing list