Commit aaa95cfe authored by Thibault Saunier's avatar Thibault Saunier 🌵 Committed by GStreamer Marge Bot
Browse files

directcontrolbinding: Properly initialize default `last_value`

It was zero and in some condition it means that the control binding
values where ignored (as shown in the test). Setting it to MAXDOUBLE
so that the first time we sync the values from a a timestamp in the
right range the proper value is computed.

Part-of: <!564>
parent 30dfa177
Pipeline #178794 waiting for manual action with stages
in 47 seconds
......@@ -215,6 +215,7 @@ gst_direct_control_binding_class_init (GstDirectControlBindingClass * klass)
static void
gst_direct_control_binding_init (GstDirectControlBinding * self)
{
self->last_value = G_MAXDOUBLE;
}
static GObject *
......
......@@ -1527,6 +1527,39 @@ GST_START_TEST (controller_trigger_tolerance)
GST_END_TEST;
GST_START_TEST (controller_first_value_in_range)
{
GstControlSource *cs;
GstTimedValueControlSource *tvcs;
GstElement *elem;
elem = gst_element_factory_make ("testobj", NULL);
/* set object values */
GST_TEST_OBJ (elem)->val_int = 32;
cs = gst_interpolation_control_source_new ();
tvcs = (GstTimedValueControlSource *) cs;
g_object_set (cs, "mode", GST_INTERPOLATION_MODE_LINEAR, NULL);
fail_unless (gst_object_add_control_binding (GST_OBJECT (elem),
gst_direct_control_binding_new_absolute (GST_OBJECT (elem), "int",
cs)));
/* Add 1 value of 0 (which is the default) */
fail_unless (gst_timed_value_control_source_set (tvcs, GST_SECOND, 0));
/* First sync outside interpolation range */
gst_object_sync_values (GST_OBJECT (elem), 0);
fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 32);
gst_object_sync_values (GST_OBJECT (elem), GST_SECOND);
fail_unless_equals_int (GST_TEST_OBJ (elem)->val_int, 0);
gst_object_unref (cs);
gst_object_unref (elem);
}
GST_END_TEST;
GST_START_TEST (controller_proxy)
{
GstControlBinding *cb, *cb2;
......@@ -1665,6 +1698,7 @@ gst_controller_suite (void)
tcase_add_test (tc, controller_lfo_rsaw);
tcase_add_test (tc, controller_lfo_triangle);
tcase_add_test (tc, controller_trigger_exact);
tcase_add_test (tc, controller_first_value_in_range);
tcase_add_test (tc, controller_trigger_tolerance);
tcase_add_test (tc, controller_proxy);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment