[gcompris] core sound: fixed a race around background music



commit 840c8d7084426a52afab5dc2874d4e35a3b04539
Author: Bruno Coudoin <bcoudoin gcompris net>
Date:   Fri Aug 9 09:51:49 2013 +0200

    core sound: fixed a race around background music
    
    This commit fixes a race condition that happens when we
    start GCompris and enters an activity that mutes the
    background music before the intro music is completed.
    
    In this case, the intro music was not muted as expected.

 src/gcompris/gstreamer.c     |    2 +-
 src/gcompris/soundutil_sdl.c |    3 +++
 2 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/src/gcompris/gstreamer.c b/src/gcompris/gstreamer.c
index c0b1fbd..7ca88a6 100644
--- a/src/gcompris/gstreamer.c
+++ b/src/gcompris/gstreamer.c
@@ -125,7 +125,7 @@ gc_sound_fx_close()
 void
 gc_sound_bg_reopen()
 {
-  if(gc_prop_get()->music)
+  if(gc_prop_get()->music && !bg_paused)
     bg_play(NULL);
 }
 
diff --git a/src/gcompris/soundutil_sdl.c b/src/gcompris/soundutil_sdl.c
index 534853b..9f20ba3 100644
--- a/src/gcompris/soundutil_sdl.c
+++ b/src/gcompris/soundutil_sdl.c
@@ -135,6 +135,9 @@ gc_sound_fx_reopen()
 void
 gc_sound_bg_reopen()
 {
+  if (music_paused)
+    return;
+
   if (gc_prop_get()->fx || gc_prop_get()->music) {
     if (sound_closed)
       {


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