Skip to content
Permalink
Browse files

SDL_GetQueuedAudioSize() shouldn't grab lock when not set up for queu…

…eing.
  • Loading branch information
icculus committed Jul 30, 2014
1 parent e5d49c2 commit c5b21ea6c10defa5b22debdd56f46019f74c0a4e
Showing with 3 additions and 3 deletions.
  1. +3 −3 src/audio/SDL_audio.c
@@ -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);

0 comments on commit c5b21ea

Please sign in to comment.