Architecture help - simultaneously play 2 audio files with independent seek

TimoBHC timpearson26 at
Mon May 17 09:59:26 UTC 2021

I am trying to develop a sound system for a car. The most basic requirements
are as follows:
1. music playback (.mp3 files)
2. alert sounds (.mp3 files) - short 3 second beeps or warning noises

I have the following:

uridecodebin1 --->
                                audiomixer ---> audioconvert --->
uridecodebin2 --->

On app initialization I set the "uri" property of each uridecodebin to a
default .mp3 file and I set the "mute" property of both the audiomixer sink
pads to true. When the app receives a signal to either play a music track or
an alert sound I set the "uri" property again now to the correct .mp3 file,
unmute the appropriate mixer sink pad, and set the pipeline to PLAYING.

I run into problems when trying to play an alert sound during music playback
after the pipeline has been set to PLAYING for more than 3 seconds:
- music: set to correct "uri"
- mixer pad1: "mute" = false
- pipeline: set to PLAYING
*(.... pipeline runs for a few seconds playing the music track, then app
receives signal to play default alert sound)*
- mixer pad2: "mute" = false
- gst_element_seek_simple(alerts, GST_FORMAT_TIME, GST_SEEK_FLAG_ACCURATE |
*(problem: I don't hear the alert sound)*

If I do the above before the Pipeline has been playing for 3 seconds I can
hear the alert sound. If I do a gst_element_seek_simple() on the music
uridecodebin it also works. It seems that the only problem I have is trying
to seek the alert sound uridecodebin after it has run past the end of its
duration (3 seconds).

I tried to follow this  suggestion
by Sebastian Dröge but wasn't able to get it to work.

Is there a better architecture that I should be using like dynamically
adding the uridecodebin's to the pipeline when needed and remove them later?
Any advice is greatly appreciated.


Sent from:

More information about the gstreamer-devel mailing list