Skip to content

Commit

Permalink
SDL_GetQueuedAudioSize() shouldn't grab lock when not set up for queu…
Browse files Browse the repository at this point in the history
…eing.
  • Loading branch information
icculus committed Jul 30, 2014
1 parent e5d49c2 commit c5b21ea
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/audio/SDL_audio.c
Expand Up @@ -472,11 +472,11 @@ SDL_QueueAudio(SDL_AudioDeviceID devid, const void *_data, Uint32 len)
Uint32
SDL_GetQueuedAudioSize(SDL_AudioDeviceID devid)
{
/* this happens to work for non-queueing devices, since we memset()
the device to zero at init time, and these devices should return 0. */
Uint32 retval = 0;
SDL_AudioDevice *device = get_audio_device(devid);
if (device) {

/* Nothing to do unless we're set up for queueing. */
if (device && (device->spec.callback == SDL_BufferQueueDrainCallback)) {
current_audio.impl.LockDevice(device);
retval = device->queued_bytes + current_audio.impl.GetPendingBytes(device);
current_audio.impl.UnlockDevice(device);
Expand Down

0 comments on commit c5b21ea

Please sign in to comment.