SDL_GetQueuedAudioSize() shouldn't grab lock when not set up for queueing.
authorRyan C. Gordon
Wed, 30 Jul 2014 11:11:48 -0400
changeset 903236c472422d64
parent 9031 e963a13a720c
child 9034 335b60fba5c2
SDL_GetQueuedAudioSize() shouldn't grab lock when not set up for queueing.
src/audio/SDL_audio.c
     1.1 --- a/src/audio/SDL_audio.c	Wed Jul 30 11:08:31 2014 -0400
     1.2 +++ b/src/audio/SDL_audio.c	Wed Jul 30 11:11:48 2014 -0400
     1.3 @@ -472,11 +472,11 @@
     1.4  Uint32
     1.5  SDL_GetQueuedAudioSize(SDL_AudioDeviceID devid)
     1.6  {
     1.7 -    /* this happens to work for non-queueing devices, since we memset()
     1.8 -       the device to zero at init time, and these devices should return 0. */
     1.9      Uint32 retval = 0;
    1.10      SDL_AudioDevice *device = get_audio_device(devid);
    1.11 -    if (device) {
    1.12 +
    1.13 +    /* Nothing to do unless we're set up for queueing. */
    1.14 +    if (device && (device->spec.callback == SDL_BufferQueueDrainCallback)) {
    1.15          current_audio.impl.LockDevice(device);
    1.16          retval = device->queued_bytes + current_audio.impl.GetPendingBytes(device);
    1.17          current_audio.impl.UnlockDevice(device);