From 73151ffc11cb87b197bf457bb87d0dd397205a13 Mon Sep 17 00:00:00 2001 From: Stefan Kost Date: Fri, 20 Jun 2008 08:32:36 +0000 Subject: [PATCH] libs/gst/controller/gstcontroller.c: Use freeze/thaw notify to sync notify emission a bit (its also more efficient). ... Original commit message from CVS: * libs/gst/controller/gstcontroller.c: Use freeze/thaw notify to sync notify emission a bit (its also more efficient). Move debug output to LOG (is called a lot in a loop). Always unset g_values if the have been initialized. --- ChangeLog | 7 +++++++ libs/gst/controller/gstcontroller.c | 18 ++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1ae53d6..b3e68be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2008-06-20 Stefan Kost + + * libs/gst/controller/gstcontroller.c: + Use freeze/thaw notify to sync notify emission a bit (its also more + efficient). Move debug output to LOG (is called a lot in a loop). + Always unset g_values if the have been initialized. + 2008-06-20 Wim Taymans * libs/gst/base/gstbasesink.c: (gst_base_sink_get_sync_times), diff --git a/libs/gst/controller/gstcontroller.c b/libs/gst/controller/gstcontroller.c index 16d05e4..9f852e3 100644 --- a/libs/gst/controller/gstcontroller.c +++ b/libs/gst/controller/gstcontroller.c @@ -666,7 +666,8 @@ gst_controller_sync_values (GstController * self, GstClockTime timestamp) { GstControlledProperty *prop; GList *node; - gboolean ret = FALSE; + gboolean ret; + GValue value = { 0, }; g_return_val_if_fail (GST_IS_CONTROLLER (self), FALSE); g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE); @@ -674,25 +675,30 @@ gst_controller_sync_values (GstController * self, GstClockTime timestamp) GST_LOG ("sync_values"); g_mutex_lock (self->lock); + g_object_freeze_notify (self->object); /* go over the controlled properties of the controller */ for (node = self->properties; node; node = g_list_next (node)) { - GValue value = { 0, }; prop = node->data; - GST_DEBUG (" property '%s' at ts=%" G_GUINT64_FORMAT, prop->name, - timestamp); + GST_LOG ("property '%s' at ts=%" G_GUINT64_FORMAT, prop->name, timestamp); if (!prop->csource || prop->disabled) continue; + /* we can make this faster + * http://bugzilla.gnome.org/show_bug.cgi?id=536939 + */ g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (prop->pspec)); ret = gst_control_source_get_value (prop->csource, timestamp, &value); - if (ret) { + if (G_LIKELY (ret)) { g_object_set_property (self->object, prop->name, &value); - g_value_unset (&value); + } else { + GST_LOG ("no control value"); } + g_value_unset (&value); } self->priv->last_sync = timestamp; + g_object_thaw_notify (self->object); g_mutex_unlock (self->lock); -- 2.7.4