output/openal: use alGetSourcei(AL_BUFFER) to force-unqueue buffers
The implementation of cancel() did not work well: you cannot use alSourceUnqueueBuffers() to unqueue queued buffers, and our function openal_unqueue_buffers() left the OpenAL library in a rather undefined state; nothing was supposed to be queued, but the "filled" variable was not reset.
This commit is contained in:
parent
c0070b2f13
commit
e735abe334
1
NEWS
1
NEWS
|
@ -16,6 +16,7 @@ ver 0.17 (2011/??/??)
|
||||||
- dsdiff: new decoder plugin
|
- dsdiff: new decoder plugin
|
||||||
* output:
|
* output:
|
||||||
- httpd: support for streaming to a DLNA client
|
- httpd: support for streaming to a DLNA client
|
||||||
|
- openal: improve buffer cancellation
|
||||||
- osx: allow user to specify other audio devices
|
- osx: allow user to specify other audio devices
|
||||||
- raop: new output plugin
|
- raop: new output plugin
|
||||||
- shout: add possibility to set url
|
- shout: add possibility to set url
|
||||||
|
|
|
@ -109,19 +109,6 @@ openal_setup_context(struct openal_data *od,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
openal_unqueue_buffers(struct openal_data *od)
|
|
||||||
{
|
|
||||||
ALint num;
|
|
||||||
ALuint buffer;
|
|
||||||
|
|
||||||
alGetSourcei(od->source, AL_BUFFERS_QUEUED, &num);
|
|
||||||
|
|
||||||
while (num--) {
|
|
||||||
alSourceUnqueueBuffers(od->source, 1, &buffer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct audio_output *
|
static struct audio_output *
|
||||||
openal_init(const struct config_param *param, GError **error_r)
|
openal_init(const struct config_param *param, GError **error_r)
|
||||||
{
|
{
|
||||||
|
@ -256,7 +243,10 @@ openal_cancel(struct audio_output *ao)
|
||||||
od->filled = 0;
|
od->filled = 0;
|
||||||
alcMakeContextCurrent(od->context);
|
alcMakeContextCurrent(od->context);
|
||||||
alSourceStop(od->source);
|
alSourceStop(od->source);
|
||||||
openal_unqueue_buffers(od);
|
|
||||||
|
/* force-unqueue all buffers */
|
||||||
|
alSourcei(od->source, AL_BUFFER, 0);
|
||||||
|
od->filled = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct audio_output_plugin openal_output_plugin = {
|
const struct audio_output_plugin openal_output_plugin = {
|
||||||
|
|
Loading…
Reference in New Issue