From cacb844d6fe526298ec02c4b44dfca7f4e9a3a12 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 28 Sep 2005 11:03:58 +0000 Subject: [PATCH] gst/gstbin.c: Some documentation updates. Original commit message from CVS: * gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree), (update_outdegree), (find_element), (gst_bin_sort_iterator_next), (gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free), (gst_bin_iterate_sorted), (gst_bin_element_set_state), (gst_bin_change_state), (gst_bin_dispose): Some documentation updates. Clean up dispose handlers. * gst/gstobject.c: (gst_object_ref), (gst_object_unref): * gst/gstpad.c: (gst_pad_dispose): Clean up dispose handler. * gst/gstpipeline.c: (gst_pipeline_change_state): Removed spurious UNLOCK. --- ChangeLog | 17 +++++++++++++++++ gst/gstbin.c | 17 +++++++++++++---- gst/gstobject.c | 2 -- gst/gstpad.c | 24 ++++++------------------ gst/gstpipeline.c | 1 - 5 files changed, 36 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index ae5454342..ef0132a1d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2005-09-28 Wim Taymans + + * gst/gstbin.c: (add_to_queue), (clear_queue), (reset_outdegree), + (update_outdegree), (find_element), (gst_bin_sort_iterator_next), + (gst_bin_sort_iterator_resync), (gst_bin_sort_iterator_free), + (gst_bin_iterate_sorted), (gst_bin_element_set_state), + (gst_bin_change_state), (gst_bin_dispose): + Some documentation updates. + Clean up dispose handlers. + + * gst/gstobject.c: (gst_object_ref), (gst_object_unref): + * gst/gstpad.c: (gst_pad_dispose): + Clean up dispose handler. + + * gst/gstpipeline.c: (gst_pipeline_change_state): + Removed spurious UNLOCK. + 2005-09-27 Stefan Kost * docs/gst/gstreamer-sections.txt: diff --git a/gst/gstbin.c b/gst/gstbin.c index 4b0024894..9a47f33cd 100644 --- a/gst/gstbin.c +++ b/gst/gstbin.c @@ -1053,6 +1053,14 @@ done: /*********************************************** * Topologically sorted iterator * see http://en.wikipedia.org/wiki/Topological_sorting + * + * For each element in the graph, an entry is kept in a HashTable + * with its number of srcpad connections (degree). + * We then change state of all elements without dependencies + * (degree 0) and decrement the degree of all elements connected + * on the sinkpads. When an element reaches degree 0, its state is + * changed next. + * When all elements are handled the algorithm stops. */ typedef struct _GstBinSortIterator { @@ -1201,7 +1209,7 @@ gst_bin_sort_iterator_next (GstBinSortIterator * bit, gpointer * result) /* we don't fail on this one yet */ g_warning ("loop detected in the graph !!"); } - /* best unhandled elements, scheduler as next element */ + /* best unhandled element, schedule as next element */ GST_DEBUG ("queue empty, next best: %s", GST_ELEMENT_NAME (bit->best)); gst_object_ref (bit->best); HASH_SET_DEGREE (bit, bit->best, -1); @@ -1458,9 +1466,10 @@ gst_bin_dispose (GObject * object) while (bin->children) { gst_bin_remove (bin, GST_ELEMENT (bin->children->data)); } - GST_CAT_DEBUG_OBJECT (GST_CAT_REFCOUNTING, object, "dispose no children"); - g_assert (bin->children == NULL); - g_assert (bin->numchildren == 0); + if (G_UNLIKELY (bin->children != NULL)) { + g_critical ("could not remove elements from bin %s", + GST_STR_NULL (GST_OBJECT_NAME (object))); + } G_OBJECT_CLASS (parent_class)->dispose (object); } diff --git a/gst/gstobject.c b/gst/gstobject.c index c4f9d3043..1157755e0 100644 --- a/gst/gstobject.c +++ b/gst/gstobject.c @@ -376,7 +376,6 @@ gst_object_ref (gpointer object) g_atomic_int_inc (&((GstObject *) object)->refcount); PATCH_REFCOUNT (object); #else - /* FIXME, not MT safe because glib is not MT safe */ g_object_ref (object); #endif @@ -427,7 +426,6 @@ gst_object_unref (gpointer object) PATCH_REFCOUNT (object); } #else - /* FIXME, not MT safe because glib is not MT safe */ g_object_unref (object); #endif } diff --git a/gst/gstpad.c b/gst/gstpad.c index 853b43aa4..86d5dc416 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -302,30 +302,17 @@ gst_pad_dispose (GObject * object) { GstPad *pad = GST_PAD (object); - gst_pad_set_pad_template (pad, NULL); - /* FIXME, we have links to many other things like caps - * and the peer pad... */ - - /* No linked pad can ever be disposed. - * It has to have a parent to be linked - * and a parent would hold a reference */ - /* FIXME: what about if g_object_dispose is explicitly called on the pad? Is - that legal? otherwise we could assert GST_OBJECT_PARENT (pad) == NULL as - well... */ GST_CAT_DEBUG (GST_CAT_REFCOUNTING, "dispose %s:%s", GST_DEBUG_PAD_NAME (pad)); - g_assert (GST_PAD_PEER (pad) == NULL); + /* we don't hold a ref to the peer so we can just set the + * peer to NULL. */ + GST_PAD_PEER (pad) = NULL; /* clear the caps */ gst_caps_replace (&GST_PAD_CAPS (pad), NULL); - if (GST_IS_ELEMENT (GST_OBJECT_PARENT (pad))) { - GST_CAT_DEBUG (GST_CAT_REFCOUNTING, "removing pad from element '%s'", - GST_OBJECT_NAME (GST_OBJECT (GST_ELEMENT (GST_OBJECT_PARENT (pad))))); - - gst_element_remove_pad (GST_ELEMENT (GST_OBJECT_PARENT (pad)), pad); - } + gst_pad_set_pad_template (pad, NULL); G_OBJECT_CLASS (parent_class)->dispose (object); } @@ -3287,7 +3274,8 @@ dropping: * @size: The length of the buffer * @buffer: a pointer to hold the #GstBuffer. * - * Pulls a buffer from the peer pad. @pad must be linked. + * Pulls a buffer from the peer pad. @pad must be a linked + * sinkpad. * * Returns: a #GstFlowReturn from the peer pad. * diff --git a/gst/gstpipeline.c b/gst/gstpipeline.c index f45088822..dea2475cb 100644 --- a/gst/gstpipeline.c +++ b/gst/gstpipeline.c @@ -327,7 +327,6 @@ gst_pipeline_change_state (GstElement * element, GstStateChange transition) GST_TIME_ARGS (start_time), GST_TIME_ARGS (element->base_time)); GST_UNLOCK (element); } else { - GST_UNLOCK (element); GST_DEBUG ("no clock, using base time of 0"); gst_element_set_base_time (element, 0); } -- 2.39.2