random cleanups and paranoia checks
authorThomas Vander Stichele <thomas@apestaart.org>
Fri, 29 Nov 2002 13:59:30 +0000 (13:59 +0000)
committerThomas Vander Stichele <thomas@apestaart.org>
Fri, 29 Nov 2002 13:59:30 +0000 (13:59 +0000)
Original commit message from CVS:
random cleanups and paranoia checks

examples/manual/Makefile.am
gst/cothreads.c
tests/old/examples/manual/Makefile.am
tests/old/testsuite/cleanup/cleanup4.c
tests/old/testsuite/threads/threadc.c
tests/old/testsuite/threads/threadf.c
testsuite/cleanup/cleanup4.c
testsuite/threads/threadc.c
testsuite/threads/threadf.c

index 00eb365..370d6a6 100644 (file)
@@ -4,7 +4,7 @@ else
 GNOME=
 endif
 
-EXAMPLES = dynamic $(GNOME) helloworld helloworld2 queue xml-mp3
+EXAMPLES = dynamic $(GNOME) helloworld helloworld2 queue threads xml-mp3
 noinst_PROGRAMS = $(EXAMPLES)
 
 LDADD = $(GST_LIBS)
@@ -23,5 +23,5 @@ EXTRA_DIST = extract.pl
 # also, it's a bit irritating that right now a change in any xml file
 # triggers a rebuild of all examples
 #%.c:
-dynamic.c gnome.c helloworld.c helloworld2.c queue.c xml-mp3.c: $(top_srcdir)/docs/manual/*.xml
+dynamic.c gnome.c helloworld.c helloworld2.c queue.c threads.c xml-mp3.c: $(top_srcdir)/docs/manual/*.xml
        $(srcdir)/extract.pl $@ $(top_srcdir)/docs/manual/*.xml
index f4386f7..a66e956 100644 (file)
@@ -296,7 +296,10 @@ cothread_free (cothread_state *cothread)
             cothread->cothreadnum);
 
   /* we simply flag the cothread for destruction here */
-  cothread->flags |= COTHREAD_DESTROYED;
+  if (cothread)
+    cothread->flags |= COTHREAD_DESTROYED;
+  else
+    g_warning ("somebody set up us the bomb");
 }
 
 static void
index 00eb365..370d6a6 100644 (file)
@@ -4,7 +4,7 @@ else
 GNOME=
 endif
 
-EXAMPLES = dynamic $(GNOME) helloworld helloworld2 queue xml-mp3
+EXAMPLES = dynamic $(GNOME) helloworld helloworld2 queue threads xml-mp3
 noinst_PROGRAMS = $(EXAMPLES)
 
 LDADD = $(GST_LIBS)
@@ -23,5 +23,5 @@ EXTRA_DIST = extract.pl
 # also, it's a bit irritating that right now a change in any xml file
 # triggers a rebuild of all examples
 #%.c:
-dynamic.c gnome.c helloworld.c helloworld2.c queue.c xml-mp3.c: $(top_srcdir)/docs/manual/*.xml
+dynamic.c gnome.c helloworld.c helloworld2.c queue.c threads.c xml-mp3.c: $(top_srcdir)/docs/manual/*.xml
        $(srcdir)/extract.pl $@ $(top_srcdir)/docs/manual/*.xml
index 91b92f7..4d0eb35 100644 (file)
@@ -24,7 +24,7 @@ main (gint argc, gchar *argv[])
     GstElement *bin;
     GstElement *fakesink;
 
-    fprintf (stderr, "+");
+    g_print ("+");
 
     bin = gst_bin_new ("bin");
 
@@ -41,11 +41,11 @@ main (gint argc, gchar *argv[])
 
     gst_element_set_state (pipeline, GST_STATE_NULL);
 
-    fprintf (stderr, "-");
+    g_print ("-");
     gst_bin_remove (GST_BIN (pipeline), GST_ELEMENT (bin));
 
   }
-  fprintf (stderr, "\n");
+  g_print ("\n");
   g_mem_chunk_info ();
 
   return 0;
index 6f34794..d357138 100644 (file)
@@ -8,7 +8,7 @@ gboolean running = FALSE;
 gboolean can_quit = FALSE;
 
 static void
-construct_pipeline (GstElement *pipeline, gint identities) 
+construct_pipeline (GstElement *pipeline, gint identities)
 {
   GstElement *src, *sink, *identity;
   GstElement *from;
@@ -31,7 +31,7 @@ construct_pipeline (GstElement *pipeline, gint identities)
   }
   gst_element_connect (identity, sink);
 
-  g_object_set (G_OBJECT (src), "num_buffers", 10, "sizetype", 3, NULL);
+  g_object_set (G_OBJECT (src), "num_buffers", 2, "sizetype", 3, NULL);
 }
 
 void
@@ -56,7 +56,7 @@ state_changed (GstElement *el, gint arg1, gint arg2, gpointer user_data)
 int
 main (gint argc, gchar *argv[])
 {
-  int runs = 130;
+  int runs = 290;
   int i;
   gulong id;
   GstElement *thread;
@@ -69,12 +69,13 @@ main (gint argc, gchar *argv[])
     g_assert (thread);
 
     /* connect state change signal */
-    id = g_signal_connect (G_OBJECT (thread), "state_change", 
+    id = g_signal_connect (G_OBJECT (thread), "state_change",
                           G_CALLBACK (state_changed), NULL);
     construct_pipeline (thread, i / 10 + 1);
 
     g_print ("Setting thread to play with %d identities\n", i / 10 + 1);
-    gst_element_set_state (thread, GST_STATE_PLAYING);
+    if (gst_element_set_state (thread, GST_STATE_PLAYING) == GST_STATE_FAILURE)
+      g_error ("Failed setting thread to play\n");
 
     g_print ("Going into the main GStreamer loop\n");
     can_quit = TRUE; /* we don't want gst_main_quit called before gst_main */
index e219971..7db234f 100644 (file)
@@ -48,7 +48,7 @@ thread (void)
   int i;
   GstElement *pipeline;
 
-  for (i = 0; i < runs; ++i)
+  for (i = 50; i < runs; ++i)
   {
     pipeline = gst_pipeline_new ("main_pipeline");
     g_assert (pipeline);
index 91b92f7..4d0eb35 100644 (file)
@@ -24,7 +24,7 @@ main (gint argc, gchar *argv[])
     GstElement *bin;
     GstElement *fakesink;
 
-    fprintf (stderr, "+");
+    g_print ("+");
 
     bin = gst_bin_new ("bin");
 
@@ -41,11 +41,11 @@ main (gint argc, gchar *argv[])
 
     gst_element_set_state (pipeline, GST_STATE_NULL);
 
-    fprintf (stderr, "-");
+    g_print ("-");
     gst_bin_remove (GST_BIN (pipeline), GST_ELEMENT (bin));
 
   }
-  fprintf (stderr, "\n");
+  g_print ("\n");
   g_mem_chunk_info ();
 
   return 0;
index 6f34794..d357138 100644 (file)
@@ -8,7 +8,7 @@ gboolean running = FALSE;
 gboolean can_quit = FALSE;
 
 static void
-construct_pipeline (GstElement *pipeline, gint identities) 
+construct_pipeline (GstElement *pipeline, gint identities)
 {
   GstElement *src, *sink, *identity;
   GstElement *from;
@@ -31,7 +31,7 @@ construct_pipeline (GstElement *pipeline, gint identities)
   }
   gst_element_connect (identity, sink);
 
-  g_object_set (G_OBJECT (src), "num_buffers", 10, "sizetype", 3, NULL);
+  g_object_set (G_OBJECT (src), "num_buffers", 2, "sizetype", 3, NULL);
 }
 
 void
@@ -56,7 +56,7 @@ state_changed (GstElement *el, gint arg1, gint arg2, gpointer user_data)
 int
 main (gint argc, gchar *argv[])
 {
-  int runs = 130;
+  int runs = 290;
   int i;
   gulong id;
   GstElement *thread;
@@ -69,12 +69,13 @@ main (gint argc, gchar *argv[])
     g_assert (thread);
 
     /* connect state change signal */
-    id = g_signal_connect (G_OBJECT (thread), "state_change", 
+    id = g_signal_connect (G_OBJECT (thread), "state_change",
                           G_CALLBACK (state_changed), NULL);
     construct_pipeline (thread, i / 10 + 1);
 
     g_print ("Setting thread to play with %d identities\n", i / 10 + 1);
-    gst_element_set_state (thread, GST_STATE_PLAYING);
+    if (gst_element_set_state (thread, GST_STATE_PLAYING) == GST_STATE_FAILURE)
+      g_error ("Failed setting thread to play\n");
 
     g_print ("Going into the main GStreamer loop\n");
     can_quit = TRUE; /* we don't want gst_main_quit called before gst_main */
index e219971..7db234f 100644 (file)
@@ -48,7 +48,7 @@ thread (void)
   int i;
   GstElement *pipeline;
 
-  for (i = 0; i < runs; ++i)
+  for (i = 50; i < runs; ++i)
   {
     pipeline = gst_pipeline_new ("main_pipeline");
     g_assert (pipeline);