uridecodebin: Ignore missing-plugin messages unless all decodebins post one

When playing RTSP streams there will be one decodebin per stream. If some of
them fail because of a missing plugin we should not fail completely but play
the supported streams at least.

https://bugzilla.gnome.org/show_bug.cgi?id=730868
This commit is contained in:
Sebastian Dröge 2014-06-04 17:00:34 +02:00
parent 393f090197
commit 0f43e801f2

View file

@ -981,8 +981,17 @@ no_more_pads_full (GstElement * element, gboolean subs,
done: done:
GST_URI_DECODE_BIN_UNLOCK (decoder); GST_URI_DECODE_BIN_UNLOCK (decoder);
if (final) if (final) {
gst_element_no_more_pads (GST_ELEMENT_CAST (decoder)); /* If we got not a single stream yet, that means that all
* decodebins had missing plugins for all of their streams!
*/
if (!decoder->streams || g_hash_table_size (decoder->streams) == 0) {
GST_ELEMENT_ERROR (decoder, CORE, MISSING_PLUGIN, (NULL),
("no suitable plugins found"));
} else {
gst_element_no_more_pads (GST_ELEMENT_CAST (decoder));
}
}
return; return;
} }
@ -2386,15 +2395,40 @@ handle_redirect_message (GstURIDecodeBin * dec, GstMessage * msg)
static void static void
handle_message (GstBin * bin, GstMessage * msg) handle_message (GstBin * bin, GstMessage * msg)
{ {
if (GST_MESSAGE_TYPE (msg) == GST_MESSAGE_ELEMENT switch (GST_MESSAGE_TYPE (msg)) {
&& gst_message_has_name (msg, "redirect")) { case GST_MESSAGE_ELEMENT:{
/* sort redirect messages based on the connection speed. This simplifies if (gst_message_has_name (msg, "redirect")) {
* the user of this element as it can in most cases just pick the first item /* sort redirect messages based on the connection speed. This simplifies
* of the sorted list as a good redirection candidate. It can of course * the user of this element as it can in most cases just pick the first item
* choose something else from the list if it has a better way. */ * of the sorted list as a good redirection candidate. It can of course
msg = handle_redirect_message (GST_URI_DECODE_BIN (bin), msg); * choose something else from the list if it has a better way. */
msg = handle_redirect_message (GST_URI_DECODE_BIN (bin), msg);
}
break;
}
case GST_MESSAGE_ERROR:{
GError *err = NULL;
/* Filter out missing plugin error messages from the decodebins. Only if
* all decodebins exposed no streams we will report a missing plugin
* error from no_more_pads_full()
*/
gst_message_parse_error (msg, &err, NULL);
if (g_error_matches (err, GST_CORE_ERROR, GST_CORE_ERROR_MISSING_PLUGIN)) {
no_more_pads_full (GST_ELEMENT (GST_MESSAGE_SRC (msg)), FALSE,
GST_URI_DECODE_BIN (bin));
gst_message_unref (msg);
msg = NULL;
}
g_clear_error (&err);
break;
}
default:
break;
} }
GST_BIN_CLASS (parent_class)->handle_message (bin, msg);
if (msg)
GST_BIN_CLASS (parent_class)->handle_message (bin, msg);
} }
/* generic struct passed to all query fold methods /* generic struct passed to all query fold methods