audio: simplifed check for internal callback.
authorRyan C. Gordon <icculus@icculus.org>
Tue, 09 Aug 2016 00:44:05 -0400
changeset 102704d99b888e7e5
parent 10269 6b259657cfd1
child 10271 4a1faf81a620
audio: simplifed check for internal callback.

Easier to check when it's NULL instead of a list of known internal functions.
src/audio/SDL_audio.c
     1.1 --- a/src/audio/SDL_audio.c	Sun Aug 07 02:43:20 2016 -0400
     1.2 +++ b/src/audio/SDL_audio.c	Tue Aug 09 00:44:05 2016 -0400
     1.3 @@ -1143,6 +1143,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      SDL_AudioDeviceID id = 0;
     1.9      SDL_AudioSpec _obtained;
    1.10      SDL_AudioDevice *device;
    1.11 @@ -1379,11 +1380,7 @@
    1.12          /* !!! FIXME: we don't force the audio thread stack size here because it calls into user code, but maybe we should? */
    1.13          /* buffer queueing callback only needs a few bytes, so make the stack tiny. */
    1.14          char name[64];
    1.15 -        const SDL_bool is_internal_thread =
    1.16 -            (device->spec.callback == SDL_BufferQueueDrainCallback) ||
    1.17 -            (device->spec.callback == SDL_BufferQueueFillCallback);
    1.18          const size_t stacksize = is_internal_thread ? 64 * 1024 : 0;
    1.19 -
    1.20          SDL_snprintf(name, sizeof (name), "SDLAudioDev%d", (int) device->id);
    1.21          device->thread = SDL_CreateThreadInternal(iscapture ? SDL_CaptureAudio : SDL_RunAudio, name, stacksize, device);
    1.22