libs/gst/controller/gstcontroller.c: Don't g_return_val_if_fail() on timed values with invalid timestamps inside a cr...

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.
This commit is contained in:
Tim-Philipp Müller 2006-09-29 12:24:50 +00:00
parent dd3b41efe1
commit 3040ad0e2d
3 changed files with 34 additions and 8 deletions

View file

@ -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):

2
common

@ -1 +1 @@
Subproject commit bdd0108b3540ffadeb82cee28b8867a8a6e7ae78
Subproject commit 9991f6fa61ee11475c390dd6675ef7952f079e43

View 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);
}