# HG changeset patch # User reimar # Date 1201736928 0 # Node ID f6a0f861f7e6d77eb66f4da490116fd781e6e29c # Parent 7cf1b1c1c44c5a1e3230fff563ebe568ef557129 Fix get_space calculation to always leave some space, esp. for the currently playing buffer. diff -r 7cf1b1c1c44c -r f6a0f861f7e6 libao2/ao_openal.c --- a/libao2/ao_openal.c Wed Jan 30 23:39:01 2008 +0000 +++ b/libao2/ao_openal.c Wed Jan 30 23:48:48 2008 +0000 @@ -201,7 +201,9 @@ ALint queued; unqueue_buffers(); alGetSourcei(sources[0], AL_BUFFERS_QUEUED, &queued); - return (NUM_BUF - queued) * CHUNK_SIZE * ao_data.channels; + queued = NUM_BUF - queued - 3; + if (queued < 0) return 0; + return queued * CHUNK_SIZE * ao_data.channels; } /**