2003-03-10 20:38:22 +00:00
|
|
|
#include <gst/gst.h>
|
|
|
|
|
|
|
|
gint i = 0;
|
|
|
|
GstElement *pipeline;
|
|
|
|
GstPadChainFunction oss_chain;
|
|
|
|
|
2003-05-19 15:46:39 +00:00
|
|
|
static GstElement *
|
2004-03-13 15:27:01 +00:00
|
|
|
make_and_check_element (gchar * type, gchar * name)
|
2003-05-19 15:46:39 +00:00
|
|
|
{
|
|
|
|
GstElement *element = gst_element_factory_make (type, name);
|
|
|
|
|
|
|
|
if (element == NULL) {
|
2004-03-13 15:27:01 +00:00
|
|
|
g_warning
|
2004-03-15 19:27:17 +00:00
|
|
|
("Could not run test, because element type \"%s\" is not installed. Please retry when it is. Assuming it works for now...",
|
|
|
|
type);
|
2003-10-15 01:25:41 +00:00
|
|
|
exit (1);
|
2003-05-19 15:46:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return element;
|
|
|
|
}
|
|
|
|
|
2003-03-10 20:38:22 +00:00
|
|
|
static void
|
|
|
|
create_pipeline (void)
|
|
|
|
{
|
2004-03-13 15:27:01 +00:00
|
|
|
GstElement *src;
|
2003-03-10 20:38:22 +00:00
|
|
|
GstElement *sink;
|
|
|
|
GstElement *id;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-03-10 20:38:22 +00:00
|
|
|
pipeline = gst_pipeline_new ("pipeline");
|
2003-05-19 15:46:39 +00:00
|
|
|
src = make_and_check_element ("sinesrc", "src");
|
2003-03-10 20:38:22 +00:00
|
|
|
/**
|
|
|
|
* You need a sink with a loop-based element in here, if you want to kill opt, too.
|
|
|
|
* Osssink (chain-based) only breaks the basic scheduler.
|
|
|
|
*/
|
2003-05-19 15:46:39 +00:00
|
|
|
sink = make_and_check_element ("alsasink", "sink");
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-03-10 20:38:22 +00:00
|
|
|
|
|
|
|
gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL);
|
|
|
|
gst_element_link (src, sink);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2005-10-15 15:53:14 +00:00
|
|
|
/**
|
2003-03-10 20:38:22 +00:00
|
|
|
* now make the bug appear
|
|
|
|
* I believe it has something to do with 2 chains being created in the scheduler
|
|
|
|
* but I haven't looked at it yet
|
|
|
|
* If you comment out the next 4 lines, everything works fine.
|
|
|
|
* And no, it's not because of identity, you may use any other element.
|
|
|
|
*/
|
|
|
|
gst_element_unlink (src, sink);
|
2003-05-19 15:46:39 +00:00
|
|
|
id = make_and_check_element ("identity", "id");
|
2003-03-10 20:38:22 +00:00
|
|
|
gst_bin_add (GST_BIN (pipeline), id);
|
|
|
|
gst_element_link_many (src, id, sink, NULL);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-03-10 20:38:22 +00:00
|
|
|
/* This pipeline will not be removed properly once we unref it */
|
|
|
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
2004-03-13 15:27:01 +00:00
|
|
|
}
|
2003-03-10 20:38:22 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
gint
|
|
|
|
main (gint argc, gchar * argv[])
|
2003-03-10 20:38:22 +00:00
|
|
|
{
|
|
|
|
gst_init (&argc, &argv);
|
2004-03-13 15:27:01 +00:00
|
|
|
create_pipeline ();
|
|
|
|
|
2003-03-10 20:38:22 +00:00
|
|
|
while (i < 300) {
|
|
|
|
/**
|
|
|
|
* only inc i when it works, so the program hangs when _iterate returns false,
|
|
|
|
* which it does after the first pipeline isn't unref'd properly and the next
|
|
|
|
* osssink refuses to work.
|
|
|
|
*/
|
|
|
|
if (gst_bin_iterate (GST_BIN (pipeline)))
|
|
|
|
i++;
|
|
|
|
if (i % 50 == 0) {
|
2005-06-28 09:59:01 +00:00
|
|
|
gst_object_unref (pipeline);
|
2003-03-10 20:38:22 +00:00
|
|
|
create_pipeline ();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|