Added a testsuite for pipeline cleanup etc..

Original commit message from CVS:
Added a testsuite for pipeline cleanup etc..
This commit is contained in:
Wim Taymans 2001-12-18 14:34:39 +00:00
parent 5bdbee5a89
commit b48a02d635
6 changed files with 138 additions and 4 deletions

View file

@ -1,5 +1,5 @@
# FIXME : refcounting threads
SUBDIRS = capsnego plugin bytestream
SUBDIRS = capsnego plugin bytestream cleanup
testprogs = test_gst_init
@ -12,4 +12,4 @@ LIBS = $(GST_LIBS)
CFLAGS = $(GLIB_CFLAGS) $(XML_CFLAGS) $(GST_CFLAGS)
# FIXME : refcounting threadds
DIST_SUBDIRS = capsnego plugin bytestream
DIST_SUBDIRS = capsnego plugin bytestream cleanup

View file

@ -0,0 +1,9 @@
testprogs = cleanup1
TESTS = $(testprogs)
check_PROGRAMS = $(testprogs)
# we have nothing but apps here, we can do this safely
cleanup1_LDADD = $(GST_LIBS)
cleanup1_CFLAGS = $(GST_CFLAGS) $(XML_CFLAGS) $(GLIB_CFLAGS)

View file

@ -0,0 +1,58 @@
#include <gst/gst.h>
static GstElement *
create_pipeline (void)
{
GstElement *fakesrc, *fakesink;
GstElement *pipeline;
pipeline = gst_pipeline_new ("main_pipeline");
fakesrc = gst_elementfactory_make ("fakesrc", "fakesrc");
fakesink = gst_elementfactory_make ("fakesink", "fakesink");
gst_element_connect (fakesrc, "src", fakesink, "sink");
gst_bin_add (GST_BIN (pipeline), fakesrc);
gst_bin_add (GST_BIN (pipeline), fakesink);
g_object_set (G_OBJECT (fakesrc), "num_buffers", 5, NULL);
return pipeline;
}
gint
main (gint argc, gchar *argv[])
{
GstElement *pipeline;
gint i;
gst_init (&argc, &argv);
i = 10000;
while (i--) {
g_print ("create...\n");
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);
g_print ("cleanup...\n");
gst_object_unref (GST_OBJECT (pipeline));
g_mem_chunk_info ();
}
return 0;
}

View file

@ -1,5 +1,5 @@
# FIXME : refcounting threads
SUBDIRS = capsnego plugin bytestream
SUBDIRS = capsnego plugin bytestream cleanup
testprogs = test_gst_init
@ -12,4 +12,4 @@ LIBS = $(GST_LIBS)
CFLAGS = $(GLIB_CFLAGS) $(XML_CFLAGS) $(GST_CFLAGS)
# FIXME : refcounting threadds
DIST_SUBDIRS = capsnego plugin bytestream
DIST_SUBDIRS = capsnego plugin bytestream cleanup

View file

@ -0,0 +1,9 @@
testprogs = cleanup1
TESTS = $(testprogs)
check_PROGRAMS = $(testprogs)
# we have nothing but apps here, we can do this safely
cleanup1_LDADD = $(GST_LIBS)
cleanup1_CFLAGS = $(GST_CFLAGS) $(XML_CFLAGS) $(GLIB_CFLAGS)

View file

@ -0,0 +1,58 @@
#include <gst/gst.h>
static GstElement *
create_pipeline (void)
{
GstElement *fakesrc, *fakesink;
GstElement *pipeline;
pipeline = gst_pipeline_new ("main_pipeline");
fakesrc = gst_elementfactory_make ("fakesrc", "fakesrc");
fakesink = gst_elementfactory_make ("fakesink", "fakesink");
gst_element_connect (fakesrc, "src", fakesink, "sink");
gst_bin_add (GST_BIN (pipeline), fakesrc);
gst_bin_add (GST_BIN (pipeline), fakesink);
g_object_set (G_OBJECT (fakesrc), "num_buffers", 5, NULL);
return pipeline;
}
gint
main (gint argc, gchar *argv[])
{
GstElement *pipeline;
gint i;
gst_init (&argc, &argv);
i = 10000;
while (i--) {
g_print ("create...\n");
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);
g_print ("cleanup...\n");
gst_object_unref (GST_OBJECT (pipeline));
g_mem_chunk_info ();
}
return 0;
}