Commit 6fcfcc3d6fc520d0f5d3c6a6e0fe04d8aeb6d3aa

pionere 2022-01-17T11:00:03

get rid of SkipMixerLock

diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c
index 849416c..3514ca3 100644
--- a/src/audio/SDL_audio.c
+++ b/src/audio/SDL_audio.c
@@ -335,11 +335,6 @@ SDL_AudioUnlockDevice_Default(SDL_AudioDevice * device)
 }
 
 static void
-SDL_AudioLockOrUnlockDeviceWithNoMixerLock(SDL_AudioDevice * device)
-{
-}
-
-static void
 finish_audio_entry_points_init(void)
 {
     /*
@@ -347,14 +342,6 @@ finish_audio_entry_points_init(void)
      *  blindly call them without having to check for validity first.
      */
 
-    if (current_audio.impl.SkipMixerLock) {
-        if (current_audio.impl.LockDevice == NULL) {
-            current_audio.impl.LockDevice = SDL_AudioLockOrUnlockDeviceWithNoMixerLock;
-        }
-        if (current_audio.impl.UnlockDevice == NULL) {
-            current_audio.impl.UnlockDevice = SDL_AudioLockOrUnlockDeviceWithNoMixerLock;
-        }
-    }
 
 #define FILL_STUB(x) \
         if (current_audio.impl.x == NULL) { \
@@ -1421,7 +1408,7 @@ open_audio_device(const char *devname, int iscapture,
     SDL_AtomicSet(&device->enabled, 1);
 
     /* Create a mutex for locking the sound buffers */
-    if (!current_audio.impl.SkipMixerLock) {
+    if (current_audio.impl.LockDevice == SDL_AudioLockDevice_Default) {
         device->mixer_lock = SDL_CreateMutex();
         if (device->mixer_lock == NULL) {
             close_audio_device(device);
diff --git a/src/audio/SDL_sysaudio.h b/src/audio/SDL_sysaudio.h
index 6c602f0..7d90a87 100644
--- a/src/audio/SDL_sysaudio.h
+++ b/src/audio/SDL_sysaudio.h
@@ -86,7 +86,6 @@ typedef struct SDL_AudioDriverImpl
     /* Some flags to push duplicate code into the core and reduce #ifdefs. */
     /* !!! FIXME: these should be SDL_bool */
     int ProvidesOwnCallbackThread;
-    int SkipMixerLock;
     int HasCaptureSupport;
     int OnlyHasDefaultOutputDevice;
     int OnlyHasDefaultCaptureDevice;
diff --git a/src/audio/emscripten/SDL_emscriptenaudio.c b/src/audio/emscripten/SDL_emscriptenaudio.c
index c85d8d0..0849ff8 100644
--- a/src/audio/emscripten/SDL_emscriptenaudio.c
+++ b/src/audio/emscripten/SDL_emscriptenaudio.c
@@ -339,6 +339,11 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscaptu
     return 0;
 }
 
+static void
+EMSCRIPTENAUDIO_LockOrUnlockDeviceWithNoMixerLock(SDL_AudioDevice * device)
+{
+}
+
 static int
 EMSCRIPTENAUDIO_Init(SDL_AudioDriverImpl * impl)
 {
@@ -352,7 +357,7 @@ EMSCRIPTENAUDIO_Init(SDL_AudioDriverImpl * impl)
     impl->OnlyHasDefaultOutputDevice = 1;
 
     /* no threads here */
-    impl->SkipMixerLock = 1;
+    impl->LockDevice = impl->UnlockDevice = EMSCRIPTENAUDIO_LockOrUnlockDeviceWithNoMixerLock;
     impl->ProvidesOwnCallbackThread = 1;
 
     /* check availability */
diff --git a/src/audio/qsa/SDL_qsa_audio.c b/src/audio/qsa/SDL_qsa_audio.c
index ca1539f..106d9f8 100644
--- a/src/audio/qsa/SDL_qsa_audio.c
+++ b/src/audio/qsa/SDL_qsa_audio.c
@@ -659,7 +659,6 @@ QSA_Init(SDL_AudioDriverImpl * impl)
     impl->UnlockDevice = NULL;
 
     impl->ProvidesOwnCallbackThread = 0;
-    impl->SkipMixerLock = 0;
     impl->HasCaptureSupport = 1;
     impl->OnlyHasDefaultOutputDevice = 0;
     impl->OnlyHasDefaultCaptureDevice = 0;