gst/playback/gstdecodebin.c: If we can't activate one of the decoders we plugged in (such as, say, musepackdec) for s...

Original commit message from CVS:
* gst/playback/gstdecodebin.c: (free_pad_probe_for_element),
(try_to_link_1):
If we can't activate one of the decoders we plugged in (such as,
say, musepackdec) for some reason (it might not support push mode,
for example), remove any pad probes that close_pad_link() might
have set up. This makes sure we later don't try to remove a probe
for a pad that doesn't exist any longer, and avoids nast warnings
and probably other things too.
This commit is contained in:
Tim-Philipp Müller 2008-05-01 19:11:42 +00:00
parent f8977b9e9e
commit ea0d78e8e5
2 changed files with 32 additions and 0 deletions

View file

@ -1,3 +1,14 @@
2008-05-01 Tim-Philipp Müller <tim.muller at collabora co uk>
* gst/playback/gstdecodebin.c: (free_pad_probe_for_element),
(try_to_link_1):
If we can't activate one of the decoders we plugged in (such as,
say, musepackdec) for some reason (it might not support push mode,
for example), remove any pad probes that close_pad_link() might
have set up. This makes sure we later don't try to remove a probe
for a pad that doesn't exist any longer, and avoids nast warnings
and probably other things too.
2008-04-30 Tim-Philipp Müller <tim.muller at collabora co uk>
* gst/typefind/gsttypefindfunctions.c:

View file

@ -569,6 +569,25 @@ free_pad_probes (GstDecodeBin * decode_bin)
decode_bin->probes = NULL;
}
/* used when we need to remove a probe because the decoder we plugged failed
* to activate */
static void
free_pad_probe_for_element (GstDecodeBin * decode_bin, GstElement * element)
{
GList *l;
for (l = decode_bin->probes; l != NULL; l = g_list_next (l)) {
PadProbeData *data = (PadProbeData *) l->data;
if (GST_ELEMENT_CAST (GST_PAD_PARENT (data->pad)) == element) {
gst_pad_remove_data_probe (data->pad, data->sigid);
decode_bin->probes = g_list_delete_link (decode_bin->probes, l);
g_free (data);
return;
}
}
}
static gboolean
add_fakesink (GstDecodeBin * decode_bin)
{
@ -992,6 +1011,8 @@ try_to_link_1 (GstDecodeBin * decode_bin, GstElement * srcelement, GstPad * pad,
GST_STATE_PAUSED)) == GST_STATE_CHANGE_FAILURE) {
GST_WARNING_OBJECT (decode_bin, "Couldn't set %s to PAUSED",
GST_ELEMENT_NAME (element));
/* close_link -> close_pad_link -> might have set up a pad probe */
free_pad_probe_for_element (decode_bin, element);
gst_element_set_state (element, GST_STATE_NULL);
gst_bin_remove (GST_BIN (decode_bin), element);
continue;