[gcompris-devel] [PATCH 1/1] Invoke sound_callback outside gstbus callback.

Andreas Fenkart afenkart at gmail.com
Mon Feb 21 08:48:36 UTC 2011


Deadlock occurs if new playback is scheduled from callback. Observed
with sound-memory activity, while playing 'bonus'.

Signed-off-by: Andreas Fenkart <afenkart at gmail.com>
---
 src/gcompris/gstreamer.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/src/gcompris/gstreamer.c b/src/gcompris/gstreamer.c
index 6f4499c..8f20468 100644
--- a/src/gcompris/gstreamer.c
+++ b/src/gcompris/gstreamer.c
@@ -57,6 +57,13 @@ gc_sound_init()
 }
 
 static gboolean
+run_sound_callback(gpointer data)
+{
+  gc_sound_callback((gchar *)data);
+  return FALSE; /* remove idle callback */
+}
+
+static gboolean
 fx_bus(GstBus* bus, GstMessage* msg, gpointer data)
 {
   switch( GST_MESSAGE_TYPE( msg ) )
@@ -64,7 +71,8 @@ fx_bus(GstBus* bus, GstMessage* msg, gpointer data)
     case GST_MESSAGE_EOS:
       g_warning("fx_bus: EOS START");
       gc_sound_fx_close();
-      gc_sound_callback((gchar *)data);
+      /* holds GStreamer locks */
+      g_idle_add(run_sound_callback, data);
       fx_play();
       g_warning("fx_bus: EOS END");
       break;
-- 
1.7.2.3





More information about the Gcompris-devel mailing list