From 7382cebb413dc405099ca5c5de4d6c8f1edc3191 Mon Sep 17 00:00:00 2001 From: Juha Kuikka Date: Thu, 20 Apr 2017 21:25:29 -0400 Subject: [PATCH] audio: Fix audio queue functions to use new spec structure. Using the old spec structure causes the audio queueing functions to fail due to bad callback pointers being checked. --- src/audio/SDL_audio.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/audio/SDL_audio.c b/src/audio/SDL_audio.c index a25865c35..45d137d29 100644 --- a/src/audio/SDL_audio.c +++ b/src/audio/SDL_audio.c @@ -556,7 +556,7 @@ SDL_QueueAudio(SDL_AudioDeviceID devid, const void *data, Uint32 len) return -1; /* get_audio_device() will have set the error state */ } else if (device->iscapture) { return SDL_SetError("This is a capture device, queueing not allowed"); - } else if (device->spec.callback != SDL_BufferQueueDrainCallback) { + } else if (device->callbackspec.callback != SDL_BufferQueueDrainCallback) { return SDL_SetError("Audio device has a callback, queueing not allowed"); } @@ -578,7 +578,7 @@ SDL_DequeueAudio(SDL_AudioDeviceID devid, void *data, Uint32 len) if ( (len == 0) || /* nothing to do? */ (!device) || /* called with bogus device id */ (!device->iscapture) || /* playback devices can't dequeue */ - (device->spec.callback != SDL_BufferQueueFillCallback) ) { /* not set for queueing */ + (device->callbackspec.callback != SDL_BufferQueueFillCallback) ) { /* not set for queueing */ return 0; /* just report zero bytes dequeued. */ } @@ -599,11 +599,11 @@ SDL_GetQueuedAudioSize(SDL_AudioDeviceID devid) } /* Nothing to do unless we're set up for queueing. */ - if (device->spec.callback == SDL_BufferQueueDrainCallback) { + if (device->callbackspec.callback == SDL_BufferQueueDrainCallback) { current_audio.impl.LockDevice(device); retval = ((Uint32) SDL_CountDataQueue(device->buffer_queue)) + current_audio.impl.GetPendingBytes(device); current_audio.impl.UnlockDevice(device); - } else if (device->spec.callback == SDL_BufferQueueFillCallback) { + } else if (device->callbackspec.callback == SDL_BufferQueueFillCallback) { current_audio.impl.LockDevice(device); retval = (Uint32) SDL_CountDataQueue(device->buffer_queue); current_audio.impl.UnlockDevice(device);