summaryrefslogtreecommitdiffstats
path: root/libao2/ao_alsa.c
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-10-02 16:49:41 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-10-02 16:49:41 +0000
commita79706df4638e0177b1d26f38e38f3f5609aa411 (patch)
tree7d6e3299f92229428ea8913cbbda54cdd88777b4 /libao2/ao_alsa.c
parent2946fb53a700f3ee0a8340da6a804d6e3f2bc14f (diff)
downloadmpv-a79706df4638e0177b1d26f38e38f3f5609aa411.tar.bz2
mpv-a79706df4638e0177b1d26f38e38f3f5609aa411.tar.xz
Make the ao_alsa play function always process a multiple of ao_data.outburst
except for the last chunk. Should fix high CPU usage reported e.g. here: http://bugs.gentoo.org/show_bug.cgi?id=286020 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29748 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libao2/ao_alsa.c')
-rw-r--r--libao2/ao_alsa.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libao2/ao_alsa.c b/libao2/ao_alsa.c
index 5c4c5c585b..8d2a0510c7 100644
--- a/libao2/ao_alsa.c
+++ b/libao2/ao_alsa.c
@@ -763,8 +763,11 @@ static void reset(void)
static int play(void* data, int len, int flags)
{
- int num_frames = len / bytes_per_sample;
+ int num_frames;
snd_pcm_sframes_t res = 0;
+ if (!(flags & AOPLAY_FINAL_CHUNK))
+ len = len / ao_data.outburst * ao_data.outburst;
+ num_frames = len / bytes_per_sample;
//mp_msg(MSGT_AO,MSGL_ERR,"alsa-play: frames=%i, len=%i\n",num_frames,len);