Skip to content

Commit

Permalink
audio: Fix audio queue functions to use new spec structure.
Browse files Browse the repository at this point in the history
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 7382ceb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/audio/SDL_audio.c
Expand Up @@ -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");
}

Expand All @@ -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. */
}

Expand All @@ -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);
Expand Down

0 comments on commit 7382ceb

Please sign in to comment.