Commit 54bf1042 authored by Jan Schmidt's avatar Jan Schmidt Committed by Sebastian Dröge

decodebin: Don't leak blocked pad references on errors

When the decodebin state change fails because of an error
message, we might not go through PAUSED->READY. Don't leak
a ref to decodebin pads due to pad blocking in that case.

This is because we return ASYNC going to PAUSED, and if
we fail before reaching PAUSED the only transition we'll
see is READY->NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=775893
parent 99f48994
......@@ -321,6 +321,7 @@ static gboolean gst_decode_bin_remove_element (GstBin * bin,
static gboolean check_upstream_seekable (GstDecodeBin * dbin, GstPad * pad);
static GstCaps *get_pad_caps (GstPad * pad);
static void unblock_pads (GstDecodeBin * dbin);
#define EXPOSE_LOCK(dbin) G_STMT_START { \
GST_LOG_OBJECT (dbin, \
......@@ -1128,6 +1129,8 @@ gst_decode_bin_dispose (GObject * object)
g_list_free (decode_bin->subtitles);
decode_bin->subtitles = NULL;
unblock_pads (decode_bin);
G_OBJECT_CLASS (parent_class)->dispose (object);
}
......@@ -5188,19 +5191,20 @@ unblock_pads (GstDecodeBin * dbin)
GstPad *opad;
opad = gst_ghost_pad_get_target (GST_GHOST_PAD_CAST (dpad));
if (!opad)
continue;
if (opad) {
GST_DEBUG_OBJECT (dpad, "unblocking");
if (dpad->block_id != 0) {
gst_pad_remove_probe (opad, dpad->block_id);
dpad->block_id = 0;
GST_DEBUG_OBJECT (dpad, "unblocking");
if (dpad->block_id != 0) {
gst_pad_remove_probe (opad, dpad->block_id);
dpad->block_id = 0;
}
gst_object_unref (opad);
}
dpad->blocked = FALSE;
/* make flushing, prevent NOT_LINKED */
gst_pad_set_active (GST_PAD_CAST (dpad), FALSE);
gst_object_unref (dpad);
gst_object_unref (opad);
GST_DEBUG_OBJECT (dpad, "unblocked");
}
......@@ -5319,6 +5323,7 @@ gst_decode_bin_change_state (GstElement * element, GstStateChange transition)
G_CALLBACK (type_found), dbin);
break;
case GST_STATE_CHANGE_PAUSED_TO_READY:
case GST_STATE_CHANGE_READY_TO_NULL:
if (dbin->have_type_id)
g_signal_handler_disconnect (dbin->typefind, dbin->have_type_id);
dbin->have_type_id = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment