mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-03 14:08:56 +00:00
The test apps I'm using to track down cleanup issues.
Original commit message from CVS: The test apps I'm using to track down cleanup issues.
This commit is contained in:
parent
34f05211c2
commit
59d1e1d051
8 changed files with 284 additions and 10 deletions
|
@ -1,9 +1,13 @@
|
||||||
testprogs = cleanup1
|
testprogs = cleanup1 cleanup2 cleanup3
|
||||||
|
|
||||||
TESTS = $(testprogs)
|
TESTS = $(testprogs)
|
||||||
|
|
||||||
check_PROGRAMS = $(testprogs)
|
check_PROGRAMS = $(testprogs)
|
||||||
|
|
||||||
# we have nothing but apps here, we can do this safely
|
# we have nothing but apps here, we can do this safely
|
||||||
cleanup1_LDADD = $(GST_LIBS)
|
cleanup1_LDADD = $(GST_LIBS) #-ldmallocth
|
||||||
cleanup1_CFLAGS = $(GST_CFLAGS) $(XML_CFLAGS) $(GLIB_CFLAGS)
|
cleanup1_CFLAGS = $(GST_CFLAGS) $(XML_CFLAGS) $(GLIB_CFLAGS)
|
||||||
|
cleanup2_LDADD = $(GST_LIBS)
|
||||||
|
cleanup2_CFLAGS = $(GST_CFLAGS) $(XML_CFLAGS) $(GLIB_CFLAGS)
|
||||||
|
cleanup3_LDADD = $(GST_LIBS)
|
||||||
|
cleanup3_CFLAGS = $(GST_CFLAGS) $(XML_CFLAGS) $(GLIB_CFLAGS)
|
||||||
|
|
|
@ -28,12 +28,15 @@ main (gint argc, gchar *argv[])
|
||||||
GstElement *pipeline;
|
GstElement *pipeline;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
|
free (malloc(8)); /* -lefence */
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
gst_init (&argc, &argv);
|
||||||
|
|
||||||
i = 10000;
|
i = 10000;
|
||||||
|
|
||||||
|
g_mem_chunk_info ();
|
||||||
while (i--) {
|
while (i--) {
|
||||||
g_print ("create...\n");
|
fprintf (stderr, "+");
|
||||||
pipeline = create_pipeline ();
|
pipeline = create_pipeline ();
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||||
|
@ -48,11 +51,12 @@ main (gint argc, gchar *argv[])
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
gst_element_set_state (pipeline, GST_STATE_NULL);
|
||||||
|
|
||||||
g_print ("cleanup...\n");
|
fprintf (stderr, "-");
|
||||||
gst_object_unref (GST_OBJECT (pipeline));
|
gst_object_unref (GST_OBJECT (pipeline));
|
||||||
|
|
||||||
g_mem_chunk_info ();
|
|
||||||
}
|
}
|
||||||
|
fprintf (stderr, "\n");
|
||||||
|
g_mem_chunk_info ();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
63
tests/old/testsuite/cleanup/cleanup2.c
Normal file
63
tests/old/testsuite/cleanup/cleanup2.c
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
#include <gst/gst.h>
|
||||||
|
|
||||||
|
static GstElement *
|
||||||
|
create_pipeline (void)
|
||||||
|
{
|
||||||
|
GstElement *fakesrc, *fakesink;
|
||||||
|
GstElement *pipeline;
|
||||||
|
GstElement *bin;
|
||||||
|
|
||||||
|
pipeline = gst_pipeline_new ("main_pipeline");
|
||||||
|
|
||||||
|
fakesrc = gst_elementfactory_make ("fakesrc", "fakesrc");
|
||||||
|
bin = gst_bin_new ("bin");
|
||||||
|
fakesink = gst_elementfactory_make ("fakesink", "fakesink");
|
||||||
|
gst_bin_add (GST_BIN (bin), fakesink);
|
||||||
|
gst_element_add_ghost_pad (bin, gst_element_get_pad (fakesink, "sink"), "sink");
|
||||||
|
|
||||||
|
gst_element_connect (fakesrc, "src", bin, "sink");
|
||||||
|
|
||||||
|
gst_bin_add (GST_BIN (pipeline), fakesrc);
|
||||||
|
gst_bin_add (GST_BIN (pipeline), bin);
|
||||||
|
|
||||||
|
g_object_set (G_OBJECT (fakesrc), "num_buffers", 5, NULL);
|
||||||
|
|
||||||
|
return pipeline;
|
||||||
|
}
|
||||||
|
|
||||||
|
gint
|
||||||
|
main (gint argc, gchar *argv[])
|
||||||
|
{
|
||||||
|
GstElement *pipeline;
|
||||||
|
gint i;
|
||||||
|
|
||||||
|
free (malloc(8)); /* -lefence */
|
||||||
|
|
||||||
|
gst_init (&argc, &argv);
|
||||||
|
|
||||||
|
i = 10000;
|
||||||
|
|
||||||
|
g_mem_chunk_info ();
|
||||||
|
while (i--) {
|
||||||
|
fprintf (stderr, "+");
|
||||||
|
pipeline = create_pipeline ();
|
||||||
|
|
||||||
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||||
|
|
||||||
|
while (gst_bin_iterate (GST_BIN (pipeline)));
|
||||||
|
|
||||||
|
gst_element_set_state (pipeline, GST_STATE_NULL);
|
||||||
|
|
||||||
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||||
|
|
||||||
|
while (gst_bin_iterate (GST_BIN (pipeline)));
|
||||||
|
|
||||||
|
gst_element_set_state (pipeline, GST_STATE_NULL);
|
||||||
|
|
||||||
|
fprintf (stderr, "-");
|
||||||
|
gst_object_unref (GST_OBJECT (pipeline));
|
||||||
|
}
|
||||||
|
g_mem_chunk_info ();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
66
tests/old/testsuite/cleanup/cleanup3.c
Normal file
66
tests/old/testsuite/cleanup/cleanup3.c
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
#include <gst/gst.h>
|
||||||
|
|
||||||
|
static GstElement *
|
||||||
|
create_pipeline (void)
|
||||||
|
{
|
||||||
|
GstElement *fakesrc, *fakesink;
|
||||||
|
GstElement *pipeline;
|
||||||
|
GstElement *thread, *queue;
|
||||||
|
|
||||||
|
pipeline = gst_pipeline_new ("main_pipeline");
|
||||||
|
|
||||||
|
fakesrc = gst_elementfactory_make ("fakesrc", "fakesrc");
|
||||||
|
thread = gst_thread_new ("thread");
|
||||||
|
fakesink = gst_elementfactory_make ("fakesink", "fakesink");
|
||||||
|
queue = gst_elementfactory_make ("queue", "queue");
|
||||||
|
gst_bin_add (GST_BIN (thread), fakesink);
|
||||||
|
gst_bin_add (GST_BIN (thread), queue);
|
||||||
|
gst_element_connect (queue, "src", fakesink, "sink");
|
||||||
|
gst_element_add_ghost_pad (thread, gst_element_get_pad (queue, "sink"), "sink");
|
||||||
|
|
||||||
|
gst_element_connect (fakesrc, "src", thread, "sink");
|
||||||
|
|
||||||
|
gst_bin_add (GST_BIN (pipeline), fakesrc);
|
||||||
|
gst_bin_add (GST_BIN (pipeline), thread);
|
||||||
|
|
||||||
|
g_object_set (G_OBJECT (fakesrc), "num_buffers", 5, NULL);
|
||||||
|
|
||||||
|
return pipeline;
|
||||||
|
}
|
||||||
|
|
||||||
|
gint
|
||||||
|
main (gint argc, gchar *argv[])
|
||||||
|
{
|
||||||
|
GstElement *pipeline;
|
||||||
|
gint i;
|
||||||
|
|
||||||
|
free (malloc(8)); /* -lefence */
|
||||||
|
|
||||||
|
gst_init (&argc, &argv);
|
||||||
|
|
||||||
|
i = 10000;
|
||||||
|
|
||||||
|
g_mem_chunk_info ();
|
||||||
|
while (i--) {
|
||||||
|
fprintf (stderr, "+");
|
||||||
|
pipeline = create_pipeline ();
|
||||||
|
|
||||||
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||||
|
|
||||||
|
while (gst_bin_iterate (GST_BIN (pipeline)));
|
||||||
|
|
||||||
|
gst_element_set_state (pipeline, GST_STATE_NULL);
|
||||||
|
|
||||||
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||||
|
|
||||||
|
while (gst_bin_iterate (GST_BIN (pipeline)));
|
||||||
|
|
||||||
|
gst_element_set_state (pipeline, GST_STATE_NULL);
|
||||||
|
|
||||||
|
fprintf (stderr, "-");
|
||||||
|
gst_object_unref (GST_OBJECT (pipeline));
|
||||||
|
}
|
||||||
|
g_mem_chunk_info ();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
|
@ -1,9 +1,13 @@
|
||||||
testprogs = cleanup1
|
testprogs = cleanup1 cleanup2 cleanup3
|
||||||
|
|
||||||
TESTS = $(testprogs)
|
TESTS = $(testprogs)
|
||||||
|
|
||||||
check_PROGRAMS = $(testprogs)
|
check_PROGRAMS = $(testprogs)
|
||||||
|
|
||||||
# we have nothing but apps here, we can do this safely
|
# we have nothing but apps here, we can do this safely
|
||||||
cleanup1_LDADD = $(GST_LIBS)
|
cleanup1_LDADD = $(GST_LIBS) #-ldmallocth
|
||||||
cleanup1_CFLAGS = $(GST_CFLAGS) $(XML_CFLAGS) $(GLIB_CFLAGS)
|
cleanup1_CFLAGS = $(GST_CFLAGS) $(XML_CFLAGS) $(GLIB_CFLAGS)
|
||||||
|
cleanup2_LDADD = $(GST_LIBS)
|
||||||
|
cleanup2_CFLAGS = $(GST_CFLAGS) $(XML_CFLAGS) $(GLIB_CFLAGS)
|
||||||
|
cleanup3_LDADD = $(GST_LIBS)
|
||||||
|
cleanup3_CFLAGS = $(GST_CFLAGS) $(XML_CFLAGS) $(GLIB_CFLAGS)
|
||||||
|
|
|
@ -28,12 +28,15 @@ main (gint argc, gchar *argv[])
|
||||||
GstElement *pipeline;
|
GstElement *pipeline;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
|
free (malloc(8)); /* -lefence */
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
gst_init (&argc, &argv);
|
||||||
|
|
||||||
i = 10000;
|
i = 10000;
|
||||||
|
|
||||||
|
g_mem_chunk_info ();
|
||||||
while (i--) {
|
while (i--) {
|
||||||
g_print ("create...\n");
|
fprintf (stderr, "+");
|
||||||
pipeline = create_pipeline ();
|
pipeline = create_pipeline ();
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||||
|
@ -48,11 +51,12 @@ main (gint argc, gchar *argv[])
|
||||||
|
|
||||||
gst_element_set_state (pipeline, GST_STATE_NULL);
|
gst_element_set_state (pipeline, GST_STATE_NULL);
|
||||||
|
|
||||||
g_print ("cleanup...\n");
|
fprintf (stderr, "-");
|
||||||
gst_object_unref (GST_OBJECT (pipeline));
|
gst_object_unref (GST_OBJECT (pipeline));
|
||||||
|
|
||||||
g_mem_chunk_info ();
|
|
||||||
}
|
}
|
||||||
|
fprintf (stderr, "\n");
|
||||||
|
g_mem_chunk_info ();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
63
testsuite/cleanup/cleanup2.c
Normal file
63
testsuite/cleanup/cleanup2.c
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
#include <gst/gst.h>
|
||||||
|
|
||||||
|
static GstElement *
|
||||||
|
create_pipeline (void)
|
||||||
|
{
|
||||||
|
GstElement *fakesrc, *fakesink;
|
||||||
|
GstElement *pipeline;
|
||||||
|
GstElement *bin;
|
||||||
|
|
||||||
|
pipeline = gst_pipeline_new ("main_pipeline");
|
||||||
|
|
||||||
|
fakesrc = gst_elementfactory_make ("fakesrc", "fakesrc");
|
||||||
|
bin = gst_bin_new ("bin");
|
||||||
|
fakesink = gst_elementfactory_make ("fakesink", "fakesink");
|
||||||
|
gst_bin_add (GST_BIN (bin), fakesink);
|
||||||
|
gst_element_add_ghost_pad (bin, gst_element_get_pad (fakesink, "sink"), "sink");
|
||||||
|
|
||||||
|
gst_element_connect (fakesrc, "src", bin, "sink");
|
||||||
|
|
||||||
|
gst_bin_add (GST_BIN (pipeline), fakesrc);
|
||||||
|
gst_bin_add (GST_BIN (pipeline), bin);
|
||||||
|
|
||||||
|
g_object_set (G_OBJECT (fakesrc), "num_buffers", 5, NULL);
|
||||||
|
|
||||||
|
return pipeline;
|
||||||
|
}
|
||||||
|
|
||||||
|
gint
|
||||||
|
main (gint argc, gchar *argv[])
|
||||||
|
{
|
||||||
|
GstElement *pipeline;
|
||||||
|
gint i;
|
||||||
|
|
||||||
|
free (malloc(8)); /* -lefence */
|
||||||
|
|
||||||
|
gst_init (&argc, &argv);
|
||||||
|
|
||||||
|
i = 10000;
|
||||||
|
|
||||||
|
g_mem_chunk_info ();
|
||||||
|
while (i--) {
|
||||||
|
fprintf (stderr, "+");
|
||||||
|
pipeline = create_pipeline ();
|
||||||
|
|
||||||
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||||
|
|
||||||
|
while (gst_bin_iterate (GST_BIN (pipeline)));
|
||||||
|
|
||||||
|
gst_element_set_state (pipeline, GST_STATE_NULL);
|
||||||
|
|
||||||
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||||
|
|
||||||
|
while (gst_bin_iterate (GST_BIN (pipeline)));
|
||||||
|
|
||||||
|
gst_element_set_state (pipeline, GST_STATE_NULL);
|
||||||
|
|
||||||
|
fprintf (stderr, "-");
|
||||||
|
gst_object_unref (GST_OBJECT (pipeline));
|
||||||
|
}
|
||||||
|
g_mem_chunk_info ();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
66
testsuite/cleanup/cleanup3.c
Normal file
66
testsuite/cleanup/cleanup3.c
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
#include <gst/gst.h>
|
||||||
|
|
||||||
|
static GstElement *
|
||||||
|
create_pipeline (void)
|
||||||
|
{
|
||||||
|
GstElement *fakesrc, *fakesink;
|
||||||
|
GstElement *pipeline;
|
||||||
|
GstElement *thread, *queue;
|
||||||
|
|
||||||
|
pipeline = gst_pipeline_new ("main_pipeline");
|
||||||
|
|
||||||
|
fakesrc = gst_elementfactory_make ("fakesrc", "fakesrc");
|
||||||
|
thread = gst_thread_new ("thread");
|
||||||
|
fakesink = gst_elementfactory_make ("fakesink", "fakesink");
|
||||||
|
queue = gst_elementfactory_make ("queue", "queue");
|
||||||
|
gst_bin_add (GST_BIN (thread), fakesink);
|
||||||
|
gst_bin_add (GST_BIN (thread), queue);
|
||||||
|
gst_element_connect (queue, "src", fakesink, "sink");
|
||||||
|
gst_element_add_ghost_pad (thread, gst_element_get_pad (queue, "sink"), "sink");
|
||||||
|
|
||||||
|
gst_element_connect (fakesrc, "src", thread, "sink");
|
||||||
|
|
||||||
|
gst_bin_add (GST_BIN (pipeline), fakesrc);
|
||||||
|
gst_bin_add (GST_BIN (pipeline), thread);
|
||||||
|
|
||||||
|
g_object_set (G_OBJECT (fakesrc), "num_buffers", 5, NULL);
|
||||||
|
|
||||||
|
return pipeline;
|
||||||
|
}
|
||||||
|
|
||||||
|
gint
|
||||||
|
main (gint argc, gchar *argv[])
|
||||||
|
{
|
||||||
|
GstElement *pipeline;
|
||||||
|
gint i;
|
||||||
|
|
||||||
|
free (malloc(8)); /* -lefence */
|
||||||
|
|
||||||
|
gst_init (&argc, &argv);
|
||||||
|
|
||||||
|
i = 10000;
|
||||||
|
|
||||||
|
g_mem_chunk_info ();
|
||||||
|
while (i--) {
|
||||||
|
fprintf (stderr, "+");
|
||||||
|
pipeline = create_pipeline ();
|
||||||
|
|
||||||
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||||
|
|
||||||
|
while (gst_bin_iterate (GST_BIN (pipeline)));
|
||||||
|
|
||||||
|
gst_element_set_state (pipeline, GST_STATE_NULL);
|
||||||
|
|
||||||
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||||
|
|
||||||
|
while (gst_bin_iterate (GST_BIN (pipeline)));
|
||||||
|
|
||||||
|
gst_element_set_state (pipeline, GST_STATE_NULL);
|
||||||
|
|
||||||
|
fprintf (stderr, "-");
|
||||||
|
gst_object_unref (GST_OBJECT (pipeline));
|
||||||
|
}
|
||||||
|
g_mem_chunk_info ();
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in a new issue