]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/gstreamer0-10.git/commitdiff
libs/gst/controller/gstcontroller.c: Don't g_return_val_if_fail() on timed values...
authorTim-Philipp Müller <tim@centricular.net>
Fri, 29 Sep 2006 12:24:50 +0000 (12:24 +0000)
committerTim-Philipp Müller <tim@centricular.net>
Fri, 29 Sep 2006 12:24:50 +0000 (12:24 +0000)
Original commit message from CVS:
* libs/gst/controller/gstcontroller.c: (gst_controller_new_valist),
(gst_controller_set_from_list):
Don't g_return_val_if_fail() on timed values with invalid timestamps
inside a critical section without unlocking the mutex. Spotted by
René Stadler. (#357617)
Also, fix up refcounting properly: when returning an existing
controller, we should increase the reference only once and not
once per property and when trying to control a property again
we should also increase the refcount.

ChangeLog
common
libs/gst/controller/gstcontroller.c

index 1e1a1a2a4c464978d7a48f9c2f0a9203f7d71cca..0fa2ef10e07826590eeeb75b87e60daa8120e9d1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2006-09-29  Tim-Philipp Müller  <tim at centricular dot net>
+
+       * libs/gst/controller/gstcontroller.c: (gst_controller_new_valist),
+       (gst_controller_set_from_list):
+         Don't g_return_val_if_fail() on timed values with invalid timestamps
+         inside a critical section without unlocking the mutex. Spotted by
+         René Stadler. (#357617)
+         Also, fix up refcounting properly: when returning an existing
+         controller, we should increase the reference only once and not
+         once per property and when trying to control a property again
+         we should also increase the refcount.
+
 2006-09-29  Wim Taymans  <wim@fluendo.com>
 
        * libs/gst/net/gstnetclientclock.c: (gst_net_client_clock_thread):
diff --git a/common b/common
index bdd0108b3540ffadeb82cee28b8867a8a6e7ae78..9991f6fa61ee11475c390dd6675ef7952f079e43 160000 (submodule)
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit bdd0108b3540ffadeb82cee28b8867a8a6e7ae78
+Subproject commit 9991f6fa61ee11475c390dd6675ef7952f079e43
index fcb80e10a2fd42cb80ae83b02fec3599b2fa33f9..acb73d864d5479a7e1c7f03fd80624634822a569 100644 (file)
@@ -455,6 +455,7 @@ gst_controller_new_valist (GObject * object, va_list var_args)
 {
   GstController *self;
   GstControlledProperty *prop;
+  gboolean ref_existing = TRUE;
   gchar *name;
 
   g_return_val_if_fail (G_IS_OBJECT (object), NULL);
@@ -485,14 +486,23 @@ gst_controller_new_valist (GObject * object, va_list var_args)
           self->object = object;
           /* store the controller */
           g_object_set_qdata (object, __gst_controller_key, self);
+          ref_existing = FALSE;
         } else {
-          g_object_ref (self);
-          GST_INFO ("returning existing controller");
+          /* only want one single _ref(), even for multiple properties */
+          if (ref_existing) {
+            g_object_ref (self);
+            ref_existing = FALSE;
+            GST_INFO ("returning existing controller");
+          }
         }
         self->properties = g_list_prepend (self->properties, prop);
       }
     } else {
       GST_WARNING ("trying to control property again");
+      if (ref_existing) {
+        g_object_ref (self);
+        ref_existing = FALSE;
+      }
     }
   }
   va_end (var_args);
@@ -760,11 +770,15 @@ gst_controller_set_from_list (GstController * self, gchar * property_name,
     for (node = timedvalues; node; node = g_slist_next (node)) {
       tv = node->data;
       if (G_VALUE_TYPE (&tv->value) == prop->type) {
-        g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (tv->timestamp), FALSE);
-        /* TODO copy the timed value or just link in? */
-        prop->values =
-            g_list_insert_sorted (prop->values, tv, gst_timed_value_compare);
-        res = TRUE;
+        if (GST_CLOCK_TIME_IS_VALID (tv->timestamp)) {
+          /* TODO copy the timed value or just link in? */
+          prop->values =
+              g_list_insert_sorted (prop->values, tv, gst_timed_value_compare);
+          res = TRUE;
+        } else {
+          g_warning ("GstTimedValued with invalid timestamp passed to %s "
+              "for property '%s'", GST_FUNCTION, property_name);
+        }
       } else {
         GST_WARNING ("incompatible value type for property '%s'", prop->name);
       }