[gst-cvs] gstreamer: miniobject: Directly increate mini_object in mini_object_free()

Edward Hervey bilboed at kemper.freedesktop.org
Mon Oct 11 10:06:19 PDT 2010


Module: gstreamer
Branch: master
Commit: 2c4afb966d2b6c734eae96cbcf94bda04e796c05
URL:    http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=2c4afb966d2b6c734eae96cbcf94bda04e796c05

Author: Edward Hervey <bilboed at bilboed.com>
Date:   Mon Oct 11 18:55:14 2010 +0200

miniobject: Directly increate mini_object in mini_object_free()

Speeds up mini_object_unref by 25% by avoiding the typecheck which
is avoidable here since it is only called on existing miniobjects.

---

 gst/gstminiobject.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/gst/gstminiobject.c b/gst/gstminiobject.c
index 0d7e287..2d12865 100644
--- a/gst/gstminiobject.c
+++ b/gst/gstminiobject.c
@@ -324,7 +324,11 @@ gst_mini_object_free (GstMiniObject * mini_object)
   /* At this point, the refcount of the object is 0. We increase the refcount
    * here because if a subclass recycles the object and gives out a new
    * reference we don't want to free the instance anymore. */
-  gst_mini_object_ref (mini_object);
+  GST_CAT_TRACE (GST_CAT_REFCOUNTING, "%p ref %d->%d", mini_object,
+      GST_MINI_OBJECT_REFCOUNT_VALUE (mini_object),
+      GST_MINI_OBJECT_REFCOUNT_VALUE (mini_object) + 1);
+
+  g_atomic_int_inc (&mini_object->refcount);
 
   mo_class = GST_MINI_OBJECT_GET_CLASS (mini_object);
   mo_class->finalize (mini_object);





More information about the Gstreamer-commits mailing list