Commit c9aaf466 authored by Wim Taymans's avatar Wim Taymans
Browse files

gst/: Fix refcounting in utils function.

Original commit message from CVS:
* gst/gstelement.c: (gst_element_add_pad), (gst_element_query):
* gst/gstutils.c: (gst_element_get_compatible_pad_template),
(gst_element_link_pads), (gst_element_query_position),
(gst_element_query_convert), (intersect_caps_func),
(gst_pad_query_position), (gst_pad_query_convert):
Fix refcounting in utils function.
No point in trying to activate a pad when it's added, it could
be added from the state change function and then we deadlock, the
element has to decide what to do.
parent e44beb9f
2005-05-11 Wim Taymans <wim@fluendo.com>
* gst/gstelement.c: (gst_element_add_pad), (gst_element_query):
* gst/gstutils.c: (gst_element_get_compatible_pad_template),
(gst_element_link_pads), (gst_element_query_position),
(gst_element_query_convert), (intersect_caps_func),
(gst_pad_query_position), (gst_pad_query_convert):
Fix refcounting in utils function.
No point in trying to activate a pad when it's added, it could
be added from the state change function and then we deadlock, the
element has to decide what to do.
2005-05-10 Andy Wingo <wingo@pobox.com>
* gst/elements/gstfakesink.c (gst_fakesink_render): Er, emit with
......
......@@ -453,7 +453,8 @@ gst_element_get_index (GstElement * element)
* Adds a pad (link point) to @element. @pad's parent will be set to @element;
* see gst_object_set_parent() for refcounting information.
*
* Pads are automatically activated when the element is in state PLAYING.
* Pads are not automatically activated so elements should perform the needed
* steps to activate the pad.
*
* The pad and the element should be unlocked when calling this function.
*
......@@ -508,13 +509,6 @@ gst_element_add_pad (GstElement * element, GstPad * pad)
element->pads_cookie++;
GST_UNLOCK (element);
GST_STATE_LOCK (element);
/* activate pad when we are playing */
if (GST_STATE (element) == GST_STATE_PLAYING)
/* FIXME, figure out mode */
gst_pad_set_active (pad, GST_ACTIVATE_PUSH);
GST_STATE_UNLOCK (element);
/* emit the NEW_PAD signal */
g_signal_emit (G_OBJECT (element), gst_element_signals[NEW_PAD], 0, pad);
......
......@@ -852,8 +852,15 @@ gst_element_link_pads (GstElement * src, const gchar * srcpadname,
GST_DEBUG_PAD_NAME (srcpad));
if ((GST_PAD_DIRECTION (srcpad) == GST_PAD_SRC) &&
(GST_PAD_PEER (srcpad) == NULL)) {
GstPad *temp = destpadname ? destpad :
gst_element_get_compatible_pad (dest, srcpad, NULL);
GstPad *temp;
if (destpadname) {
temp = destpad;
gst_object_ref (GST_OBJECT (temp));
} else {
temp = gst_element_get_compatible_pad (dest, srcpad, NULL);
gst_object_ref (GST_OBJECT (temp));
}
if (temp && gst_pad_link (srcpad, temp) == GST_PAD_LINK_OK) {
GST_CAT_DEBUG (GST_CAT_ELEMENT_PADS, "linked pad %s:%s to pad %s:%s",
......@@ -884,7 +891,8 @@ gst_element_link_pads (GstElement * src, const gchar * srcpadname,
gst_object_unref (GST_OBJECT (destpad));
return FALSE;
} else {
gst_object_unref (GST_OBJECT (srcpad));
if (srcpad)
gst_object_unref (GST_OBJECT (srcpad));
srcpad = NULL;
}
if (destpad) {
......
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