How to play multiple URIs with uridecodebin without interrupting pipeline?

Tony Houghton h at realh.co.uk
Tue May 8 15:00:08 UTC 2018


On Mon, 7 May 2018 at 23:21, Tony Houghton <h at realh.co.uk> wrote:

> I'm writing a program which uses uridecodebin to decode music files and
> mix them (using audiomixer) with other generated sounds from audiotestsrc
> etc. I want to be able to pass an arbitrary number of URIs to the
> uridecodebin and have it loop, ie start again with the first URI when it's
> played the last one, and switch tracks without interrupting the other
> sounds in the pipeline. It doesn't matter whether the transitions are
> gapless. How can I do that?
>

The situation is worse than I thought. It seems like there's a race
condition. At first mixing a music file with a test signal worked on my
laptop but not on my Raspberry Pi. When I started experimenting to try to
debug it I started getting similar problems on my laptop. The symptoms
vary. Sometimes linking the uridecodebin's dynamic src pad to the next
stage in the pipeline (audioconvert) fails. Sometimes that succeeds, but
then I get a not-negotiated error from an element within uridecodebin as a
bus message. Or the same audioconvert element I mentioned above might raise
either of those errors. Or it works, but I get not-negotiated warnings (as
opposed to errors) from the other branch of the pipeline containing the
audiotestsrc.

Just doing things like printing the warnings or not, or generating a dot
file, without changing the way I build and link the pipeline, causes enough
disruption somehow to affect whether it works or not. My first approach
(which worked on the laptop but not on the RPi) was to add everything to
the pipeline to start with and link everything except the uridecodebin and
its downstream audioconvert, then set the pipeline's state to PLAYING. The
first thing I tried was to set the state to PAUSED first instead, then
change it to PLAYING at the end of the pad-added handler, but that was the
first thing that broke it on my laptop.

The attached dot file shows the state of the pipeline in the pad-added
handler when attempting to link it has failed. If it had succeeded the
src_0 pad in the UriDecodeBin should be linked to the sink pad in the
AudioConvert element named "music_conv".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20180508/a833d9b3/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pipeline1.dot
Type: application/msword-template
Size: 25863 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20180508/a833d9b3/attachment-0001.bin>


More information about the gstreamer-devel mailing list