Fixed bug 3584 - Small stack size for audio callback thread
authorSam Lantinga
Sat, 11 Feb 2017 16:38:16 -0800
changeset 108812a8921196432
parent 10880 5a77f977ad95
child 10882 3f210b3522a3
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/5a77f977ad95/src/audio/SDL_audio.c#l1132, where the is_internal_thread flag appears to be inverted.
src/audio/SDL_audio.c
     1.1 --- a/src/audio/SDL_audio.c	Sat Feb 11 11:14:48 2017 -0800
     1.2 +++ b/src/audio/SDL_audio.c	Sat Feb 11 16:38:16 2017 -0800
     1.3 @@ -1129,7 +1129,7 @@
     1.4                    const SDL_AudioSpec * desired, SDL_AudioSpec * obtained,
     1.5                    int allowed_changes, int min_id)
     1.6  {
     1.7 -    const SDL_bool is_internal_thread = (desired->callback != NULL);
     1.8 +    const SDL_bool is_internal_thread = (desired->callback == NULL);
     1.9      SDL_AudioDeviceID id = 0;
    1.10      SDL_AudioSpec _obtained;
    1.11      SDL_AudioDevice *device;