mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
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:
parent
a80a63d5db
commit
aadf0570fa
3 changed files with 54 additions and 6 deletions
|
@ -1,4 +1,4 @@
|
||||||
noinst_PROGRAMS = threadstate1 threadstate2 threadstate3
|
noinst_PROGRAMS = threadstate1 threadstate2 threadstate3 threadstate4
|
||||||
|
|
||||||
LDADD = $(GST_LIBS)
|
LDADD = $(GST_LIBS)
|
||||||
AM_CFLAGS = $(GST_CFLAGS)
|
AM_CFLAGS = $(GST_CFLAGS)
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
int main(int argc,char *argv[])
|
int main(int argc,char *argv[])
|
||||||
{
|
{
|
||||||
GstElement *fakesrc, *fakesink;
|
GstElement *fakesrc, *fakesink;
|
||||||
GstElement *thread, *pipeline;
|
GstElement *thread, *thread2;
|
||||||
gint x;
|
gint x;
|
||||||
|
|
||||||
gst_init(&argc,&argv);
|
gst_init(&argc,&argv);
|
||||||
|
@ -11,10 +11,10 @@ int main(int argc,char *argv[])
|
||||||
thread = gst_thread_new("thread");
|
thread = gst_thread_new("thread");
|
||||||
g_assert(thread != NULL);
|
g_assert(thread != NULL);
|
||||||
|
|
||||||
pipeline = gst_pipeline_new("pipeline");
|
thread2 = gst_thread_new("thread2");
|
||||||
g_assert(pipeline != NULL);
|
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");
|
fakesrc = gst_element_factory_make("fakesrc", "fake_source");
|
||||||
g_assert(fakesrc != NULL);
|
g_assert(fakesrc != NULL);
|
||||||
|
@ -22,7 +22,7 @@ int main(int argc,char *argv[])
|
||||||
fakesink = gst_element_factory_make("fakesink", "fake_sink");
|
fakesink = gst_element_factory_make("fakesink", "fake_sink");
|
||||||
g_assert(fakesink != NULL);
|
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);
|
gst_element_connect (fakesrc, fakesink);
|
||||||
|
|
||||||
for (x = 0 ; x < 10 ; x++){
|
for (x = 0 ; x < 10 ; x++){
|
||||||
|
|
48
tests/threadstate/threadstate4.c
Normal file
48
tests/threadstate/threadstate4.c
Normal 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);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue