Skip to content
Permalink
Browse files

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.
  • Loading branch information
Juha Kuikka committed Apr 21, 2017
1 parent 93a6191 commit 7382cebb413dc405099ca5c5de4d6c8f1edc3191
Showing with 4 additions and 4 deletions.
  1. +4 −4 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);

0 comments on commit 7382ceb

Please sign in to comment.