summaryrefslogtreecommitdiffstats
path: root/libao2/ao_alsa.c
diff options
context:
space:
mode:
authoruau <uau@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-09-24 21:49:58 +0000
committeruau <uau@b3059339-0415-0410-9bf9-f77b7e298cf2>2007-09-24 21:49:58 +0000
commit50e46d7681f77d9e062e7df9122c461abf21e57b (patch)
treea83d869211764171d715d4b9022e068fe474cbaf /libao2/ao_alsa.c
parentb12a08fe6ac6dcc7158e45af7c02b62713ea717f (diff)
downloadmpv-50e46d7681f77d9e062e7df9122c461abf21e57b.tar.bz2
mpv-50e46d7681f77d9e062e7df9122c461abf21e57b.tar.xz
ao_alsa: Fix get_space() return values larger than buffersize
After a buffer underrun the ALSA get_space() function sometimes returned values larger than the ao had set in ao_data.buffersize. Fix this by replacing the old check against MAX_OUTBURST by one against ao_data.buffersize. There should be no need for the MAX_OUTBURST check; the current MPlayer side should no longer have any constant limit on the amount of data an ao can buffer or request at once. The get_space() values larger than ao_data.buffersize triggered errors in audio decoding causing the current attempt to fill audio buffers to be aborted. I'm not sure how often that caused behavior noticeably worse then an underrun already is. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@24610 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libao2/ao_alsa.c')
-rw-r--r--libao2/ao_alsa.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libao2/ao_alsa.c b/libao2/ao_alsa.c
index 62adba41e8..53a9768730 100644
--- a/libao2/ao_alsa.c
+++ b/libao2/ao_alsa.c
@@ -861,8 +861,8 @@ static int get_space(void)
}
ret = snd_pcm_status_get_avail(status) * bytes_per_sample;
- if (ret > MAX_OUTBURST)
- ret = MAX_OUTBURST;
+ if (ret > ao_data.buffersize) // Buffer underrun?
+ ret = ao_data.buffersize;
return(ret);
}