summaryrefslogtreecommitdiffstats
path: root/libao2
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-01-30 23:48:48 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2008-01-30 23:48:48 +0000
commitc87beafb2cd14724a82d7904a3fe27a4f9b5eae7 (patch)
treece9b37ff1bcc2fee055fb327e0d470d0e309d2f4 /libao2
parentc470666c579c9d390da9a68022c433fd5ad0a5ff (diff)
downloadmpv-c87beafb2cd14724a82d7904a3fe27a4f9b5eae7.tar.bz2
mpv-c87beafb2cd14724a82d7904a3fe27a4f9b5eae7.tar.xz
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
Diffstat (limited to 'libao2')
-rw-r--r--libao2/ao_openal.c4
1 files changed, 3 insertions, 1 deletions
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;
}
/**