Fix example apps by drawing in the main-loop.
authorStefan Kost <ensonic@users.sf.net>
Tue, 27 Jan 2009 21:09:05 +0000 (23:09 +0200)
committerStefan Kost <ensonic@users.sf.net>
Tue, 27 Jan 2009 21:10:36 +0000 (23:10 +0200)
tests/examples/spectrum/demo-audiotest.c
tests/examples/spectrum/demo-osssrc.c

index d21857a..d04552d 100644 (file)
@@ -93,16 +93,21 @@ draw_spectrum (gfloat * data)
 
 /* process delayed message */
 static gboolean
-delayed_spectrum_update (GstClock * sync_clock, GstClockTime time,
-    GstClockID id, gpointer user_data)
+delayed_idle_spectrum_update (gpointer user_data)
 {
-  if (!GST_CLOCK_TIME_IS_VALID (time))
-    goto done;
-
   draw_spectrum ((gfloat *) user_data);
-
-done:
   g_free (user_data);
+  return (FALSE);
+}
+
+static gboolean
+delayed_spectrum_update (GstClock * sync_clock, GstClockTime time,
+    GstClockID id, gpointer user_data)
+{
+  if (GST_CLOCK_TIME_IS_VALID (time))
+    g_idle_add (delayed_idle_spectrum_update, user_data);
+  else
+    g_free (user_data);
   return (TRUE);
 }
 
index dd19ca1..c7ae846 100644 (file)
@@ -82,16 +82,21 @@ draw_spectrum (gfloat * data)
 
 /* process delayed message */
 static gboolean
-delayed_spectrum_update (GstClock * sync_clock, GstClockTime time,
-    GstClockID id, gpointer user_data)
+delayed_idle_spectrum_update (gpointer user_data)
 {
-  if (!GST_CLOCK_TIME_IS_VALID (time))
-    goto done;
-
   draw_spectrum ((gfloat *) user_data);
-
-done:
   g_free (user_data);
+  return (FALSE);
+}
+
+static gboolean
+delayed_spectrum_update (GstClock * sync_clock, GstClockTime time,
+    GstClockID id, gpointer user_data)
+{
+  if (GST_CLOCK_TIME_IS_VALID (time))
+    g_idle_add (delayed_idle_spectrum_update, user_data);
+  else
+    g_free (user_data);
   return (TRUE);
 }