Commit 886736a2c8f58723c8e63411122d5f171aaaf988

Sam Lantinga 2017-02-11T16:38:16

Fixed bug 3584 - Small stack size for audio callback thread Walter van Niftrik We have found that since SDL 2.0.5 the audio callback thread is created with a very small stack size. In our application this is leading to stack overflows. We believe there is a bug at http://hg.libsdl.org/SDL/file/391fd532f79e/src/audio/SDL_audio.c#l1132, where the is_internal_thread flag appears to be inverted.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c
index a4fcd11..989259c 100644
--- a/src/audio/SDL_audio.c
+++ b/src/audio/SDL_audio.c
@@ -1129,7 +1129,7 @@ open_audio_device(const char *devname, int iscapture,
                   const SDL_AudioSpec * desired, SDL_AudioSpec * obtained,
                   int allowed_changes, int min_id)
 {
-    const SDL_bool is_internal_thread = (desired->callback != NULL);
+    const SDL_bool is_internal_thread = (desired->callback == NULL);
     SDL_AudioDeviceID id = 0;
     SDL_AudioSpec _obtained;
     SDL_AudioDevice *device;