[MPlayer-dev-eng] ALSA issue, r29549
Reimar Döffinger
Reimar.Doeffinger at gmx.de
Tue Sep 29 16:28:43 CEST 2009
On Tue, Sep 29, 2009 at 02:59:41PM +0200, Clemens Ladisch wrote:
> Uoti Urpala wrote:
> > This thread doesn't seem to have any clear information. The general code
> > is supposed to work with any size of values.
>
> Well, the ALSA code is also supposed to work with any values ...
Not sure about the deeper issue, but the following patch seems to fix it
and I think it should be a good idea - of course I do not know if the
issue might still reappear if snd_pcm_writei only does a partial write,
nor do I know if the performance issue is due to ALSA in which case it
might be better to change snd_pcm_writei to return a nicely rounded
value.
Index: libao2/ao_alsa.c
===================================================================
--- libao2/ao_alsa.c (revision 29732)
+++ libao2/ao_alsa.c (working copy)
@@ -763,8 +768,11 @@
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);
More information about the MPlayer-dev-eng
mailing list