From c87beafb2cd14724a82d7904a3fe27a4f9b5eae7 Mon Sep 17 00:00:00 2001 From: reimar Date: Wed, 30 Jan 2008 23:48:48 +0000 Subject: [PATCH] Fix get_space calculation to always leave some space, esp. for the currently playing buffer. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25941 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libao2/ao_openal.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libao2/ao_openal.c b/libao2/ao_openal.c index 5428f94f2b..ce1dc3d7fb 100644 --- a/libao2/ao_openal.c +++ b/libao2/ao_openal.c @@ -201,7 +201,9 @@ static int get_space(void) { 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; } /**