Error handling with playbin in gapless mode

Robert Tiemann rtie at gmx.de
Fri Jan 29 10:37:55 UTC 2021


On 1/29/21 12:07 AM, Tim Müller wrote:
> Hi Robert,

Hi!

> Have you tried checking the read-only "current-uri" property?
>
> I think this was the reason it was added originally.

Thank you for your quick answer. Honestly, I didn't expect the
current-uri property to work reliably during error handling, so I am
currently not using it. The documentation of current-uri just says,
"The currently playing uri."

If this is the intended use of current-uri, then I'll rework my error
recovery around that property. A first try confirms that the property
contains the expected URI in case typefind complains about it, so
that's great.

However, in case the URI points to some file:// that does not exist,
the filesrc plugin fails (Resource not found), and current-uri is
NULL. For bad http:// URIs resulting in DNS lookup failures or a 404,
current-uri is good and not NULL. I think that's a bit inconsistent,
but I guess it should be possible to detect this case and handle it
correctly.

A corner case that came to my mind is an ambiguity in case my queue
contains the same URI several times. If it fails while playing, then I
don't know for sure which instance the current-uri refers to
(currently playing or prefetched). Of course, I could just assume that
the URI won't play anyway and remove all instances of that URI from
the queue.

Still, it would be great if it would be possible to associate some ID
with the URI written to the uri property so that this ID could be used
to identify the currently playing instance of the URI, especially in
case of an error, to avoid this ambiguity. There is the current-audio
property, but it seems not to be intended to be used for this (it
always reads as -1 or 0, no matter if or to which value I am setting
it).

Would it be possible to attach such an ID to the stream and to extract
it during error handling?

> Cheers
>   Tim

Best regards,
Robert


More information about the gstreamer-devel mailing list