integration: some fixes for seek tests

- Use g_list_remove_link so that ordering of seeks is not mandatory
- use g_slice allocator for SeekInfo structs
- Fix leak in freeing seek list
- Check for NULL seeks at end of test, otherwise fail and free failed seeks
This commit is contained in:
Vasilis Liaskovitis 2013-07-14 14:03:46 +02:00 committed by Thibault Saunier
parent 393505b8aa
commit 68363433c9

View file

@ -68,7 +68,7 @@ static const gchar *test_image_filename = NULL;
static SeekInfo * static SeekInfo *
new_seek_info (GstClockTime seeking_position, GstClockTime position) new_seek_info (GstClockTime seeking_position, GstClockTime position)
{ {
SeekInfo *info = g_new0 (SeekInfo, 1); SeekInfo *info = g_slice_new0 (SeekInfo);
info->seeking_position = seeking_position; info->seeking_position = seeking_position;
info->position = position; info->position = position;
return info; return info;
@ -223,8 +223,9 @@ get_position (void)
GST_FORMAT_TIME, GST_FORMAT_TIME,
GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE, seek->position)); GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE, seek->position));
seeks = seeks->next; seeks = g_list_remove_link (seeks, tmp);
g_free (seek); g_slice_free (SeekInfo, seek);
g_list_free (tmp);
break; break;
} }
tmp = tmp->next; tmp = tmp->next;
@ -324,6 +325,7 @@ test_seeking (gboolean render)
GESUriClipAsset *asset1; GESUriClipAsset *asset1;
GESEffect *effect; GESEffect *effect;
GESClip *clip; GESClip *clip;
GList *tmp;
gchar *uri = ges_test_file_name (testfilename1); gchar *uri = ges_test_file_name (testfilename1);
asset1 = ges_uri_clip_asset_request_sync (uri, &error); asset1 = ges_uri_clip_asset_request_sync (uri, &error);
@ -362,6 +364,21 @@ test_seeking (gboolean render)
seeks = seeks =
g_list_append (seeks, new_seek_info (1.5 * GST_SECOND, 1.8 * GST_SECOND)); g_list_append (seeks, new_seek_info (1.5 * GST_SECOND, 1.8 * GST_SECOND));
fail_unless (test_timeline_with_profile (timeline, PROFILE_OGG, FALSE)); fail_unless (test_timeline_with_profile (timeline, PROFILE_OGG, FALSE));
if (seeks != NULL) {
/* free failed seeks */
while (seeks) {
SeekInfo *info = seeks->data;
tmp = seeks;
GST_ERROR ("Seeking at %" GST_TIME_FORMAT " to %" GST_TIME_FORMAT
" did not happen \n", GST_TIME_ARGS (info->seeking_position),
GST_TIME_ARGS (info->position));
seeks = g_list_remove_link (seeks, tmp);
g_slice_free (SeekInfo, info);
g_list_free (tmp);
}
fail_if (TRUE, "Got EOS before being able to execute all seeks");
}
} }
/* Test adding an effect [E] marks the effect */ /* Test adding an effect [E] marks the effect */