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.
Juha Kuikka 2017-04-20 21:25:29 -04:00
parent 93a6191cdc
commit 7382cebb41
1 changed files with 4 additions and 4 deletions

View File

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