source: trunk/third/gstreamer/testsuite/threads/threadg.c @ 21005

Revision 21005, 1.6 KB checked in by ghudson, 20 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r21004, which included commits to RCS files with non-trunk default branches.
Line 
1/* this tests if the GstThread is ok after removing all elements from it
2 * in PAUSED rather than NULL state.  Currently it crashes with a mutex
3 * error
4 */
5
6#include <gst/gst.h>
7
8int
9main (int argc, char **argv)
10{
11  GstElement *thread, *pipeline;
12  GstElement *src, *sink, *queue;
13  int i;
14
15  gst_init (&argc, &argv);
16
17  pipeline = gst_element_factory_make ("pipeline", "pipeline");
18
19  src = gst_element_factory_make ("fakesrc", "src");
20  g_assert (src);
21
22  gst_bin_add (GST_BIN (pipeline), src);
23
24  thread = gst_element_factory_make ("thread", "thread");
25  g_assert (thread);
26  sink = gst_element_factory_make ("fakesink", "sink");
27  g_assert (sink);
28  queue = gst_element_factory_make ("queue", "queue");
29  g_assert (queue);
30
31  gst_bin_add_many (GST_BIN (thread), queue, sink, NULL);
32
33  gst_bin_add (GST_BIN (pipeline), thread);
34
35  if (!gst_element_link_many (src, queue, sink, NULL))
36    g_assert_not_reached ();
37
38
39  if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS)
40    g_assert_not_reached ();
41
42  for (i = 0; i < 100; i++) {
43    if (!gst_bin_iterate (GST_BIN (pipeline)))
44      g_assert_not_reached ();
45    g_print ("%d\n", i);
46  }
47
48  if (gst_element_set_state (pipeline, GST_STATE_PAUSED) != GST_STATE_SUCCESS)
49    g_assert_not_reached ();
50
51  gst_bin_remove_many (GST_BIN (thread), queue, sink, NULL);
52
53  if (gst_element_set_state (thread, GST_STATE_NULL) != GST_STATE_SUCCESS)
54    g_assert_not_reached ();
55
56  gst_bin_remove (GST_BIN (pipeline), thread);
57
58  if (gst_element_set_state (pipeline, GST_STATE_PLAYING) != GST_STATE_SUCCESS)
59    g_assert_not_reached ();
60
61
62  return 0;
63}
Note: See TracBrowser for help on using the repository browser.