From ea0d78e8e51afff6a5d16c86a0d24968b2319a40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Thu, 1 May 2008 19:11:42 +0000 Subject: [PATCH] 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. --- ChangeLog | 11 +++++++++++ gst/playback/gstdecodebin.c | 21 +++++++++++++++++++++ 2 files changed, 32 insertions(+) diff --git a/ChangeLog b/ChangeLog index 336e0a928e..7f314b6b54 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2008-05-01 Tim-Philipp Müller + + * 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 * gst/typefind/gsttypefindfunctions.c: diff --git a/gst/playback/gstdecodebin.c b/gst/playback/gstdecodebin.c index f4379878b1..0fb7123774 100644 --- a/gst/playback/gstdecodebin.c +++ b/gst/playback/gstdecodebin.c @@ -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;