tests: Plug misc leaks

This commit is contained in:
Thibault Saunier 2019-04-09 08:58:24 -04:00
parent 61a659d298
commit 86ac3b3159
6 changed files with 61 additions and 31 deletions

View file

@ -115,6 +115,7 @@ GST_START_TEST (test_split_direct_bindings)
GstTimedValueControlSource *splitsource; GstTimedValueControlSource *splitsource;
GESLayer *layer; GESLayer *layer;
GESAsset *asset; GESAsset *asset;
GValue *tmpvalue;
GESTrackElement *element; GESTrackElement *element;
@ -129,6 +130,7 @@ GST_START_TEST (test_split_direct_bindings)
asset = ges_asset_request (GES_TYPE_TEST_CLIP, NULL, NULL); asset = ges_asset_request (GES_TYPE_TEST_CLIP, NULL, NULL);
clip = ges_layer_add_asset (layer, asset, 0, 10 * GST_SECOND, 10 * GST_SECOND, clip = ges_layer_add_asset (layer, asset, 0, 10 * GST_SECOND, 10 * GST_SECOND,
GES_TRACK_TYPE_UNKNOWN); GES_TRACK_TYPE_UNKNOWN);
g_object_unref (asset);
CHECK_OBJECT_PROPS (clip, 0 * GST_SECOND, 10 * GST_SECOND, 10 * GST_SECOND); CHECK_OBJECT_PROPS (clip, 0 * GST_SECOND, 10 * GST_SECOND, 10 * GST_SECOND);
assert_equals_int (g_list_length (GES_CONTAINER_CHILDREN (clip)), 1); assert_equals_int (g_list_length (GES_CONTAINER_CHILDREN (clip)), 1);
@ -146,10 +148,15 @@ GST_START_TEST (test_split_direct_bindings)
20 * GST_SECOND, 1.0); 20 * GST_SECOND, 1.0);
binding = ges_track_element_get_control_binding (element, "alpha"); binding = ges_track_element_get_control_binding (element, "alpha");
assert_equals_int (g_value_get_double (gst_control_binding_get_value (binding, tmpvalue = gst_control_binding_get_value (binding, 10 * GST_SECOND);
10 * GST_SECOND)), 0.0); assert_equals_int (g_value_get_double (tmpvalue), 0.0);
assert_equals_int (g_value_get_double (gst_control_binding_get_value (binding, g_value_unset (tmpvalue);
20 * GST_SECOND)), 1.0); g_free (tmpvalue);
tmpvalue = gst_control_binding_get_value (binding, 20 * GST_SECOND);
assert_equals_int (g_value_get_double (tmpvalue), 1.0);
g_value_unset (tmpvalue);
g_free (tmpvalue);
splitclip = ges_clip_split (clip, 5 * GST_SECOND); splitclip = ges_clip_split (clip, 5 * GST_SECOND);
CHECK_OBJECT_PROPS (splitclip, 5 * GST_SECOND, 15 * GST_SECOND, CHECK_OBJECT_PROPS (splitclip, 5 * GST_SECOND, 15 * GST_SECOND,
@ -172,6 +179,7 @@ GST_START_TEST (test_split_direct_bindings)
assert_equals_uint64 (((GstTimedValue *) values->next->data)->timestamp, assert_equals_uint64 (((GstTimedValue *) values->next->data)->timestamp,
20 * GST_SECOND); 20 * GST_SECOND);
assert_equals_float (((GstTimedValue *) values->next->data)->value, 1.0); assert_equals_float (((GstTimedValue *) values->next->data)->value, 1.0);
g_list_free (values);
values = values =
gst_timed_value_control_source_get_all (GST_TIMED_VALUE_CONTROL_SOURCE gst_timed_value_control_source_get_all (GST_TIMED_VALUE_CONTROL_SOURCE
@ -184,6 +192,7 @@ GST_START_TEST (test_split_direct_bindings)
assert_equals_uint64 (((GstTimedValue *) values->next->data)->timestamp, assert_equals_uint64 (((GstTimedValue *) values->next->data)->timestamp,
15 * GST_SECOND); 15 * GST_SECOND);
assert_equals_float (((GstTimedValue *) values->next->data)->value, 0.50); assert_equals_float (((GstTimedValue *) values->next->data)->value, 0.50);
g_list_free (values);
CHECK_OBJECT_PROPS (clip, 0 * GST_SECOND, 10 * GST_SECOND, 5 * GST_SECOND); CHECK_OBJECT_PROPS (clip, 0 * GST_SECOND, 10 * GST_SECOND, 5 * GST_SECOND);
check_layer (clip, 0); check_layer (clip, 0);
@ -204,6 +213,7 @@ GST_START_TEST (test_split_direct_absolute_bindings)
GstTimedValueControlSource *splitsource; GstTimedValueControlSource *splitsource;
GESLayer *layer; GESLayer *layer;
GESAsset *asset; GESAsset *asset;
GValue *tmpvalue;
GESTrackElement *element; GESTrackElement *element;
@ -218,6 +228,7 @@ GST_START_TEST (test_split_direct_absolute_bindings)
asset = ges_asset_request (GES_TYPE_TEST_CLIP, NULL, NULL); asset = ges_asset_request (GES_TYPE_TEST_CLIP, NULL, NULL);
clip = ges_layer_add_asset (layer, asset, 0, 10 * GST_SECOND, 10 * GST_SECOND, clip = ges_layer_add_asset (layer, asset, 0, 10 * GST_SECOND, 10 * GST_SECOND,
GES_TRACK_TYPE_UNKNOWN); GES_TRACK_TYPE_UNKNOWN);
g_object_unref (asset);
CHECK_OBJECT_PROPS (clip, 0 * GST_SECOND, 10 * GST_SECOND, 10 * GST_SECOND); CHECK_OBJECT_PROPS (clip, 0 * GST_SECOND, 10 * GST_SECOND, 10 * GST_SECOND);
assert_equals_int (g_list_length (GES_CONTAINER_CHILDREN (clip)), 1); assert_equals_int (g_list_length (GES_CONTAINER_CHILDREN (clip)), 1);
@ -235,10 +246,15 @@ GST_START_TEST (test_split_direct_absolute_bindings)
20 * GST_SECOND, 500); 20 * GST_SECOND, 500);
binding = ges_track_element_get_control_binding (element, "posx"); binding = ges_track_element_get_control_binding (element, "posx");
assert_equals_int (g_value_get_int (gst_control_binding_get_value (binding, tmpvalue = gst_control_binding_get_value (binding, 10 * GST_SECOND);
10 * GST_SECOND)), 0); assert_equals_int (g_value_get_int (tmpvalue), 0);
assert_equals_int (g_value_get_int (gst_control_binding_get_value (binding, g_value_unset (tmpvalue);
20 * GST_SECOND)), 500); g_free (tmpvalue);
tmpvalue = gst_control_binding_get_value (binding, 20 * GST_SECOND);
assert_equals_int (g_value_get_int (tmpvalue), 500);
g_value_unset (tmpvalue);
g_free (tmpvalue);
splitclip = ges_clip_split (clip, 5 * GST_SECOND); splitclip = ges_clip_split (clip, 5 * GST_SECOND);
CHECK_OBJECT_PROPS (splitclip, 5 * GST_SECOND, 15 * GST_SECOND, CHECK_OBJECT_PROPS (splitclip, 5 * GST_SECOND, 15 * GST_SECOND,
@ -261,6 +277,7 @@ GST_START_TEST (test_split_direct_absolute_bindings)
assert_equals_uint64 (((GstTimedValue *) values->next->data)->timestamp, assert_equals_uint64 (((GstTimedValue *) values->next->data)->timestamp,
20 * GST_SECOND); 20 * GST_SECOND);
assert_equals_float (((GstTimedValue *) values->next->data)->value, 500.0); assert_equals_float (((GstTimedValue *) values->next->data)->value, 500.0);
g_list_free (values);
values = values =
gst_timed_value_control_source_get_all (GST_TIMED_VALUE_CONTROL_SOURCE gst_timed_value_control_source_get_all (GST_TIMED_VALUE_CONTROL_SOURCE
@ -273,6 +290,7 @@ GST_START_TEST (test_split_direct_absolute_bindings)
assert_equals_uint64 (((GstTimedValue *) values->next->data)->timestamp, assert_equals_uint64 (((GstTimedValue *) values->next->data)->timestamp,
15 * GST_SECOND); 15 * GST_SECOND);
assert_equals_float (((GstTimedValue *) values->next->data)->value, 250.0); assert_equals_float (((GstTimedValue *) values->next->data)->value, 250.0);
g_list_free (values);
CHECK_OBJECT_PROPS (clip, 0 * GST_SECOND, 10 * GST_SECOND, 5 * GST_SECOND); CHECK_OBJECT_PROPS (clip, 0 * GST_SECOND, 10 * GST_SECOND, 5 * GST_SECOND);
check_layer (clip, 0); check_layer (clip, 0);

View file

@ -582,6 +582,7 @@ GST_START_TEST (test_group_in_self)
GES_TIMELINE_ELEMENT (group))); GES_TIMELINE_ELEMENT (group)));
clips = ges_container_get_children (GES_CONTAINER (group), TRUE); clips = ges_container_get_children (GES_CONTAINER (group), TRUE);
assert_equals_int (g_list_length (clips), 6); assert_equals_int (g_list_length (clips), 6);
g_list_free_full (clips, g_object_unref);
gst_object_unref (timeline); gst_object_unref (timeline);
gst_object_unref (asset); gst_object_unref (asset);
@ -666,12 +667,13 @@ GST_START_TEST (test_group_serialization)
fail_unless (timeline != NULL); fail_unless (timeline != NULL);
layer = timeline->layers->data; layer = timeline->layers->data;
for (tmp = ges_layer_get_clips (layer); tmp; tmp = tmp->next) { clips = ges_layer_get_clips (layer);
for (tmp = clips; tmp; tmp = tmp->next) {
fail_unless (GES_IS_GROUP (GES_TIMELINE_ELEMENT_PARENT (tmp->data)), fail_unless (GES_IS_GROUP (GES_TIMELINE_ELEMENT_PARENT (tmp->data)),
"%s parent is %p, NOT a group", GES_TIMELINE_ELEMENT_NAME (tmp->data), "%s parent is %p, NOT a group", GES_TIMELINE_ELEMENT_NAME (tmp->data),
GES_TIMELINE_ELEMENT_PARENT (tmp->data)); GES_TIMELINE_ELEMENT_PARENT (tmp->data));
} }
g_list_free_full (clips, g_object_unref);
g_free (tmpuri); g_free (tmpuri);
gst_object_unref (timeline); gst_object_unref (timeline);

View file

@ -1005,6 +1005,7 @@ GST_START_TEST (test_layer_activate_automatic_transition)
transition = transition =
GES_CLIP (ges_layer_add_asset (layer, GES_CLIP (ges_layer_add_asset (layer,
transition_asset, 1000, 0, 500, GES_TRACK_TYPE_VIDEO)); transition_asset, 1000, 0, 500, GES_TRACK_TYPE_VIDEO));
g_object_unref (transition_asset);
fail_unless (GES_IS_TRANSITION_CLIP (transition)); fail_unless (GES_IS_TRANSITION_CLIP (transition));
objects = GES_CONTAINER_CHILDREN (transition); objects = GES_CONTAINER_CHILDREN (transition);
assert_equals_int (g_list_length (objects), 1); assert_equals_int (g_list_length (objects), 1);

View file

@ -51,6 +51,7 @@ GST_START_TEST (simple_smart_adder_test)
template, NULL, NULL); template, NULL, NULL);
fail_unless (GST_IS_PAD (requested_pad)); fail_unless (GST_IS_PAD (requested_pad));
gst_object_unref (requested_pad);
gst_object_unref (smart_adder); gst_object_unref (smart_adder);
gst_object_unref (track); gst_object_unref (track);
@ -120,6 +121,7 @@ GST_START_TEST (simple_audio_mixed_with_pipeline)
tmpclip = ges_layer_add_asset (layer1, asset, 0, 0, 2 * GST_SECOND, tmpclip = ges_layer_add_asset (layer1, asset, 0, 0, 2 * GST_SECOND,
GES_TRACK_TYPE_AUDIO); GES_TRACK_TYPE_AUDIO);
g_object_unref (asset);
ges_audio_test_source_set_volume (GES_CONTAINER_CHILDREN (tmpclip)->data, 1); ges_audio_test_source_set_volume (GES_CONTAINER_CHILDREN (tmpclip)->data, 1);
@ -190,6 +192,7 @@ GST_START_TEST (audio_video_mixed_with_pipeline)
tmpclip = tmpclip =
ges_layer_add_asset (layer1, asset, 1 * GST_SECOND, 0, 5 * GST_SECOND, ges_layer_add_asset (layer1, asset, 1 * GST_SECOND, 0, 5 * GST_SECOND,
GES_TRACK_TYPE_UNKNOWN); GES_TRACK_TYPE_UNKNOWN);
g_object_unref (asset);
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
main_loop = g_main_loop_new (NULL, FALSE); main_loop = g_main_loop_new (NULL, FALSE);

View file

@ -342,9 +342,8 @@ _add_properties (GESTimeline * timeline)
(source), 5 * GST_SECOND, 0.); (source), 5 * GST_SECOND, 0.);
gst_timed_value_control_source_set (GST_TIMED_VALUE_CONTROL_SOURCE gst_timed_value_control_source_set (GST_TIMED_VALUE_CONTROL_SOURCE
(source), 10 * GST_SECOND, 1.); (source), 10 * GST_SECOND, 1.);
} } else if (GES_IS_VIDEO_SOURCE (element)) {
/* Adding children properties */ /* Adding children properties */
else if (GES_IS_VIDEO_SOURCE (element)) {
gint64 posx = 42; gint64 posx = 42;
ges_timeline_element_set_child_properties (GES_TIMELINE_ELEMENT ges_timeline_element_set_child_properties (GES_TIMELINE_ELEMENT
(element), "posx", posx, NULL); (element), "posx", posx, NULL);
@ -358,6 +357,8 @@ _add_properties (GESTimeline * timeline)
break; break;
} }
} }
g_list_free_full (tracks, g_object_unref);
} }
static void static void
@ -418,25 +419,27 @@ _check_properties (GESTimeline * timeline)
fail_unless_equals_int64 (posx, 42); fail_unless_equals_int64 (posx, 42);
} }
} }
g_list_free_full (track_elements, g_object_unref);
break; break;
default: default:
break; break;
} }
} }
g_list_free_full (tracks, g_object_unref);
} }
GST_START_TEST (test_project_add_properties) GST_START_TEST (test_project_add_properties)
{ {
GESProject *project; GESProject *project;
GESTimeline *timeline; GESTimeline *timeline;
GESAsset *formatter_asset;
gboolean saved;
gchar *uri; gchar *uri;
ges_init (); ges_init ();
uri = ges_test_file_uri ("test-properties.xges"); uri = ges_test_file_uri ("test-properties.xges");
project = ges_project_new (uri); project = ges_project_new (uri);
g_free (uri);
mainloop = g_main_loop_new (NULL, FALSE); mainloop = g_main_loop_new (NULL, FALSE);
/* Connect the signals */ /* Connect the signals */
@ -451,20 +454,16 @@ GST_START_TEST (test_project_add_properties)
GST_LOG ("Test first loading"); GST_LOG ("Test first loading");
g_free (uri);
_add_properties (timeline); _add_properties (timeline);
uri = ges_test_get_tmp_uri ("test-properties-save.xges"); uri = ges_test_get_tmp_uri ("test-properties-save.xges");
formatter_asset = ges_asset_request (GES_TYPE_FORMATTER, "ges", NULL); fail_unless (ges_project_save (project, timeline, uri, NULL, TRUE, NULL));
saved =
ges_project_save (project, timeline, uri, formatter_asset, TRUE, NULL);
fail_unless (saved);
gst_object_unref (timeline); gst_object_unref (timeline);
gst_object_unref (project); gst_object_unref (project);
project = ges_project_new (uri); project = ges_project_new (uri);
g_free (uri);
ASSERT_OBJECT_REFCOUNT (project, "Our + cache", 2); ASSERT_OBJECT_REFCOUNT (project, "Our + cache", 2);
@ -480,7 +479,6 @@ GST_START_TEST (test_project_add_properties)
gst_object_unref (timeline); gst_object_unref (timeline);
gst_object_unref (project); gst_object_unref (project);
g_free (uri);
g_main_loop_unref (mainloop); g_main_loop_unref (mainloop);
g_signal_handlers_disconnect_by_func (project, (GCallback) project_loaded_cb, g_signal_handlers_disconnect_by_func (project, (GCallback) project_loaded_cb,
@ -500,6 +498,7 @@ GST_START_TEST (test_project_load_xges)
GESTimeline *timeline; GESTimeline *timeline;
GESAsset *formatter_asset; GESAsset *formatter_asset;
gchar *uri; gchar *uri;
GList *tmp;
ges_init (); ges_init ();
@ -523,8 +522,9 @@ GST_START_TEST (test_project_load_xges)
timeline = timeline =
GES_TIMELINE (ges_asset_extract (GES_ASSET (loaded_project), NULL)); GES_TIMELINE (ges_asset_extract (GES_ASSET (loaded_project), NULL));
fail_unless (GES_IS_TIMELINE (timeline)); fail_unless (GES_IS_TIMELINE (timeline));
assert_equals_int (g_list_length (ges_project_get_loading_assets tmp = ges_project_get_loading_assets (loaded_project);
(loaded_project)), 1); assert_equals_int (g_list_length (tmp), 1);
g_list_free_full (tmp, g_object_unref);
g_main_loop_run (mainloop); g_main_loop_run (mainloop);
GST_LOG ("Test first loading"); GST_LOG ("Test first loading");
@ -578,7 +578,7 @@ GST_END_TEST;
GST_START_TEST (test_project_auto_transition) GST_START_TEST (test_project_auto_transition)
{ {
GList *layers; GList *layers, *tmp;
GESProject *project; GESProject *project;
GESTimeline *timeline; GESTimeline *timeline;
GESLayer *layer = NULL; GESLayer *layer = NULL;
@ -606,8 +606,8 @@ GST_START_TEST (test_project_auto_transition)
/* Check timeline and layers auto-transition, must be FALSE */ /* Check timeline and layers auto-transition, must be FALSE */
fail_if (ges_timeline_get_auto_transition (timeline)); fail_if (ges_timeline_get_auto_transition (timeline));
layers = ges_timeline_get_layers (timeline); layers = ges_timeline_get_layers (timeline);
for (; layers; layers = layers->next) { for (tmp = layers; tmp; tmp = tmp->next) {
layer = layers->data; layer = tmp->data;
fail_if (ges_layer_get_auto_transition (layer)); fail_if (ges_layer_get_auto_transition (layer));
} }
@ -641,8 +641,8 @@ GST_START_TEST (test_project_auto_transition)
/* Check timeline and layers auto-transition, must be TRUE */ /* Check timeline and layers auto-transition, must be TRUE */
fail_unless (ges_timeline_get_auto_transition (timeline)); fail_unless (ges_timeline_get_auto_transition (timeline));
layers = ges_timeline_get_layers (timeline); layers = ges_timeline_get_layers (timeline);
for (; layers; layers = layers->next) { for (tmp = layers; tmp; tmp = tmp->next) {
layer = layers->data; layer = tmp->data;
fail_unless (ges_layer_get_auto_transition (layer)); fail_unless (ges_layer_get_auto_transition (layer));
} }

View file

@ -84,6 +84,7 @@ GST_START_TEST (test_basic_timeline_edition)
clip2 = GES_CONTAINER (ges_layer_add_asset (layer, asset, 50, 0, 60, clip2 = GES_CONTAINER (ges_layer_add_asset (layer, asset, 50, 0, 60,
GES_TRACK_TYPE_UNKNOWN)); GES_TRACK_TYPE_UNKNOWN));
g_object_unref (asset);
trackelement2 = GES_CONTAINER_CHILDREN (clip2)->data; trackelement2 = GES_CONTAINER_CHILDREN (clip2)->data;
fail_unless (GES_IS_TRACK_ELEMENT (trackelement2)); fail_unless (GES_IS_TRACK_ELEMENT (trackelement2));
@ -436,7 +437,7 @@ asset_added_cb (GESProject * project, GESAsset * asset, void *mainloop)
GST_START_TEST (test_simple_triming) GST_START_TEST (test_simple_triming)
{ {
GList *assets; GList *assets, *tmp;
GMainLoop *mainloop; GMainLoop *mainloop;
GESClipAsset *asset; GESClipAsset *asset;
GESProject *project; GESProject *project;
@ -472,13 +473,16 @@ GST_START_TEST (test_simple_triming)
ges_layer_add_asset (layer, GES_ASSET (asset), 0, 0, 10, ges_layer_add_asset (layer, GES_ASSET (asset), 0, 0, 10,
ges_clip_asset_get_supported_formats (asset)); ges_clip_asset_get_supported_formats (asset));
g_list_free_full (assets, g_object_unref);
element = ges_layer_get_clips (layer)->data; tmp = ges_layer_get_clips (layer);
element = tmp->data;
DEEP_CHECK (element, 0, 0, 10); DEEP_CHECK (element, 0, 0, 10);
ges_container_edit (GES_CONTAINER (element), NULL, -1, GES_EDIT_MODE_TRIM, ges_container_edit (GES_CONTAINER (element), NULL, -1, GES_EDIT_MODE_TRIM,
GES_EDGE_START, 5); GES_EDGE_START, 5);
DEEP_CHECK (element, 5, 5, 5); DEEP_CHECK (element, 5, 5, 5);
g_list_free_full (tmp, g_object_unref);
g_main_loop_unref (mainloop); g_main_loop_unref (mainloop);
gst_object_unref (timeline); gst_object_unref (timeline);
@ -1229,6 +1233,7 @@ GST_START_TEST (test_scaling)
ges_layer_add_asset (layer, GES_ASSET (asset1), 0 * GST_SECOND, ges_layer_add_asset (layer, GES_ASSET (asset1), 0 * GST_SECOND,
0 * GST_SECOND, 4 * GST_SECOND, GES_TRACK_TYPE_UNKNOWN); 0 * GST_SECOND, 4 * GST_SECOND, GES_TRACK_TYPE_UNKNOWN);
gst_object_unref (asset1); gst_object_unref (asset1);
gst_object_unref (asset2);
g_object_set (clip, "vpattern", (gint) GES_VIDEO_TEST_PATTERN_SMPTE75, NULL); g_object_set (clip, "vpattern", (gint) GES_VIDEO_TEST_PATTERN_SMPTE75, NULL);
/** /**
@ -1382,6 +1387,7 @@ GST_START_TEST (test_scaling)
* are changing the aspect ratio, the video should thus not be rescaled. */ * are changing the aspect ratio, the video should thus not be rescaled. */
caps = gst_caps_from_string ("video/x-raw,height=1080,width=1920"); caps = gst_caps_from_string ("video/x-raw,height=1080,width=1920");
ges_track_set_restriction_caps (trackv, caps); ges_track_set_restriction_caps (trackv, caps);
gst_caps_unref (caps);
fail_unless (check_frame_positioner_size (clip, 320, 240)); fail_unless (check_frame_positioner_size (clip, 320, 240));
gst_object_unref (timeline); gst_object_unref (timeline);