[gcompris] Deadlock occurs if new playback is scheduled from callback. Observed with sound-memory activity, whi



commit ccd0b0f2978172348653df60bcb4ad3138325d31
Author: Andreas Fenkart <afenkart gmail com>
Date:   Tue Feb 22 23:11:48 2011 +0100

    Deadlock occurs if new playback is scheduled from callback. Observed with sound-memory activity, while playing 'bonus'.
    
    In this fix, the sound is player in the gtk idle loop instead of being called directly.

 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 01cce7b..659ccc1 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;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]