Error handling with playbin in gapless mode

Robert Tiemann rtie at gmx.de
Thu Jan 28 21:43:01 UTC 2021


Hi!

I am currently struggling with error handling using playbin in gapless
mode, and I hope someone here can help me out on this one. The
GStreamer version is 1.16.2, but upgrading should be possible if
required.

My player maintains a queue of audio URIs to play, and I am using the
"about-to-finish" signal to pull URIs from the queue so to feed them
into playbin by setting the "uri" property.

This is working very well so far, but sometimes one of the URIs fails
to play, either the one which is currently playing (maybe due to some
network failure) or the next one which has already been written to the
"uri" property, but isn't playing yet (might be typefind complaining,
might be a network failure). When an error occurs, I can see a
GST_MESSAGE_ERROR message in the bus message handler which I have
attached to the pipeline via gst_bus_add_watch(), and I'd like to
handle the error so that bad URIs can be skipped.

Now, I cannot seem to find out which URI has caused the error: the one
which is still playing (so I just need to wait for the next URI to
play), or the one which is supposed to be played next (so I need to
pull the next URI from my queue and give it to playbin), or both. My
current approach to this is to keep track of URI states (i.e., was it
handed over to playbin already, did I see some stream state change,
did I see a stream start, possibly more) and some guesswork, but this
seems to be overly complicated and fails to work correctly for certain
cases.

I think I have just missed something here. Is there a reliable way to
map an error message caught in my bus message handler to the URI which
has caused the error? This would simplify things a lot. Or should I do
error handling in a completely different way?

Thank you in advance!

Regards,
Robert


More information about the gstreamer-devel mailing list