Skip to content

Commit

Permalink
audio: simplifed check for internal callback.
Browse files Browse the repository at this point in the history
Easier to check when it's NULL instead of a list of known internal functions.
  • Loading branch information
icculus committed Aug 9, 2016
1 parent df4985e commit be8d7a4
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/audio/SDL_audio.c
Expand Up @@ -1143,6 +1143,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);
SDL_AudioDeviceID id = 0;
SDL_AudioSpec _obtained;
SDL_AudioDevice *device;
Expand Down Expand Up @@ -1379,11 +1380,7 @@ open_audio_device(const char *devname, int iscapture,
/* !!! FIXME: we don't force the audio thread stack size here because it calls into user code, but maybe we should? */
/* buffer queueing callback only needs a few bytes, so make the stack tiny. */
char name[64];
const SDL_bool is_internal_thread =
(device->spec.callback == SDL_BufferQueueDrainCallback) ||
(device->spec.callback == SDL_BufferQueueFillCallback);
const size_t stacksize = is_internal_thread ? 64 * 1024 : 0;

SDL_snprintf(name, sizeof (name), "SDLAudioDev%d", (int) device->id);
device->thread = SDL_CreateThreadInternal(iscapture ? SDL_CaptureAudio : SDL_RunAudio, name, stacksize, device);

Expand Down

0 comments on commit be8d7a4

Please sign in to comment.