threadstate4 fails randomly on state change. it is { { fakesrc } ! queue ! fakesink }

Original commit message from CVS:
threadstate4 fails randomly on state change. it is { { fakesrc } ! queue ! fakesink }
This commit is contained in:
Steve Baker 2002-06-03 18:37:36 +00:00
parent a80a63d5db
commit aadf0570fa
3 changed files with 54 additions and 6 deletions

View file

@ -1,4 +1,4 @@
noinst_PROGRAMS = threadstate1 threadstate2 threadstate3
noinst_PROGRAMS = threadstate1 threadstate2 threadstate3 threadstate4
LDADD = $(GST_LIBS)
AM_CFLAGS = $(GST_CFLAGS)

View file

@ -3,7 +3,7 @@
int main(int argc,char *argv[])
{
GstElement *fakesrc, *fakesink;
GstElement *thread, *pipeline;
GstElement *thread, *thread2;
gint x;
gst_init(&argc,&argv);
@ -11,10 +11,10 @@ int main(int argc,char *argv[])
thread = gst_thread_new("thread");
g_assert(thread != NULL);
pipeline = gst_pipeline_new("pipeline");
g_assert(pipeline != NULL);
thread2 = gst_thread_new("thread2");
g_assert(thread2 != NULL);
gst_bin_add(GST_BIN(thread), GST_ELEMENT(pipeline));
gst_bin_add(GST_BIN(thread), GST_ELEMENT(thread2));
fakesrc = gst_element_factory_make("fakesrc", "fake_source");
g_assert(fakesrc != NULL);
@ -22,7 +22,7 @@ int main(int argc,char *argv[])
fakesink = gst_element_factory_make("fakesink", "fake_sink");
g_assert(fakesink != NULL);
gst_bin_add_many (GST_BIN(pipeline), fakesrc, fakesink, NULL);
gst_bin_add_many (GST_BIN(thread2), fakesrc, fakesink, NULL);
gst_element_connect (fakesrc, fakesink);
for (x = 0 ; x < 10 ; x++){

View file

@ -0,0 +1,48 @@
#include <gst/gst.h>
int main(int argc,char *argv[])
{
GstElement *fakesrc, *fakesink;
GstElement *thread, *thread2;
GstElement *queue;
gint x;
gst_init(&argc,&argv);
thread = gst_thread_new("thread");
g_assert(thread != NULL);
thread2 = gst_thread_new("thread");
g_assert(thread2 != NULL);
queue = gst_element_factory_make("queue", "the_queue");
g_assert(queue != NULL);
fakesrc = gst_element_factory_make("fakesrc", "fake_source");
g_assert(fakesrc != NULL);
fakesink = gst_element_factory_make("fakesink", "fake_sink");
g_assert(fakesink != NULL);
gst_bin_add_many (GST_BIN(thread), thread2, queue, fakesink, NULL);
gst_bin_add(GST_BIN(thread2), fakesrc);
gst_element_add_ghost_pad (thread2, gst_element_get_pad (fakesrc, "src"), "src");
gst_element_connect_many (thread2, queue, fakesink, NULL);
for (x = 0 ; x < 10 ; x++){
g_print("playing %d\n", x);
gst_element_set_state(thread, GST_STATE_PLAYING);
sleep(1);
g_print("nulling %d\n", x);
gst_element_set_state(thread, GST_STATE_NULL);
sleep(1);
}
gst_main();
exit(0);
}