xrick: Fix a race condition that could result in audio stopping

rockbox-gerrit-noreply--- via rockbox-cvs <[email protected]>
Newsgroups gmane.comp.systems.archos.rockbox.cvs
Message-ID <[email protected]>
commit e677895e29ba5bbe517f92980941c570fb92a932
Author: Solomon Peachy <[email protected]>
Date:   Sun Mar 29 18:02:09 2026 -0400

    xrick: Fix a race condition that could result in audio stopping
    
    get_more() can disable audio when there's nothing more to genreate
    but that can get called (and "fail") _before_ we set the flag
    that audio is turned on.  If this occurs, we will incorrecly
    set the "audio on" flag after the failure which will prevent
    the mixer from being re-started.
    
    (We're at the mercy of thread scheduling)
    
    Change-Id: I4f6c50a71c7ad685ff45f775e7e4b1c61b8b7777

diff --git a/apps/plugins/xrick/system/syssnd_rockbox.c b/apps/plugins/xrick/system/syssnd_rockbox.c
index afd0766863..74edd98140 100644
--- a/apps/plugins/xrick/system/syssnd_rockbox.c
+++ b/apps/plugins/xrick/system/syssnd_rockbox.c
@@ -222,8 +222,8 @@ void syssnd_update(void)
 
         if (!isAudioPlaying && fillCount > 0)
         {
-            rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, get_more, NULL, 0);
             isAudioPlaying = true;
+            rb->mixer_channel_play_data(PCM_MIXER_CHAN_PLAYBACK, get_more, NULL, 0);
         }
     }
 }
-- 
rockbox-cvs mailing list
[email protected]
https://lists.haxx.se/mailman/listinfo/rockbox-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.