SDL_GetQueuedAudioSize() shouldn't grab lock when not set up for queueing.

main
Ryan C. Gordon 2014-07-30 11:11:48 -04:00
parent e5d49c2033
commit c5b21ea6c1
1 changed files with 3 additions and 3 deletions

View File

@ -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);