nleobject: It is wrong to update object->stop in set_property.
authorMathieu Duponchelle <mathieu.duponchelle@opencreed.com>
Wed, 8 Apr 2015 21:33:27 +0000 (23:33 +0200)
committerMathieu Duponchelle <mathieu.duponchelle@opencreed.com>
Thu, 9 Apr 2015 13:40:32 +0000 (15:40 +0200)
Summary: It must only be done when the object is commited.
We can do that in constructed though, as the changes will
anyway be commited when the object is added to a composition.

Also update the tests, as we set properties spearately then
check the stop, we can commit the source at its creation without
removing meaning from the tests.

Reviewers: thiblahute

Differential Revision: http://phabricator.freedesktop.org/D84

ges/nle/nleobject.c
tests/check/nle/common.c

index f97e5d4..2ecbfd7 100644 (file)
@@ -88,6 +88,7 @@ static void nle_object_set_property (GObject * object, guint prop_id,
     const GValue * value, GParamSpec * pspec);
 static void nle_object_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
+static void nle_object_constructed (GObject * object);
 
 static GstStateChangeReturn nle_object_change_state (GstElement * element,
     GstStateChange transition);
@@ -114,6 +115,7 @@ nle_object_class_init (NleObjectClass * klass)
 
   gobject_class->set_property = GST_DEBUG_FUNCPTR (nle_object_set_property);
   gobject_class->get_property = GST_DEBUG_FUNCPTR (nle_object_get_property);
+  gobject_class->constructed = GST_DEBUG_FUNCPTR (nle_object_constructed);
   gobject_class->dispose = GST_DEBUG_FUNCPTR (nle_object_dispose);
 
   gstelement_class->change_state = GST_DEBUG_FUNCPTR (nle_object_change_state);
@@ -514,8 +516,6 @@ nle_object_set_property (GObject * object, guint prop_id,
       break;
   }
   GST_OBJECT_UNLOCK (object);
-
-  _update_stop (nleobject);
 }
 
 static void
@@ -555,6 +555,14 @@ nle_object_get_property (GObject * object, guint prop_id,
   }
 }
 
+static void
+nle_object_constructed (GObject * object)
+{
+  NleObject *nleobject = (NleObject *) object;
+
+  _update_stop (nleobject);
+}
+
 static GstStateChangeReturn
 nle_object_change_state (GstElement * element, GstStateChange transition)
 {
index c5c582a..1862b2f 100644 (file)
@@ -178,6 +178,7 @@ new_nle_src (const gchar * name, guint64 start, gint64 duration, gint priority)
   g_object_set (G_OBJECT (nlesource),
       "start", start,
       "duration", duration, "inpoint", start, "priority", priority, NULL);
+  nle_object_commit (NLE_OBJECT (nlesource), FALSE);
 
   return nlesource;
 }