[MPlayer-dev-eng] [PATCH] alsa: use buffer_time_min instead of buffer_time_near

Clemens Ladisch cladisch at fastmail.net
Tue Sep 29 14:03:37 CEST 2009


Reimar Döffinger wrote:
> On Tue, Sep 29, 2009 at 01:48:27PM +0200, Clemens Ladisch wrote:
> > Reimar Döffinger wrote:
> > > using buffer_time_near allows ALSA to (in theory) create ridiculously
> > > small buffers which MPlayer can not handle at all
> > 
> > Disregarding the bug below, this can happen only if the device does not
> > actually support any buffer size bigger than that, so we'd only have the
> > choice between small buffer or failure.
> 
> That does not match the fact that with my sound card/also version buffer_time_min
> still works with a buffer time of 10000 while buffer_time_near does not.

buffer_time_near chooses and fixes a buffer time value, but
buffer_time_min just sets the lower bound of allowed values.
If, when calling snd_pcm_hw_params, more than one value for the buffer
size/time is still possible, ALSA will choose the largest one, so in
your case, you'll get the largest possible buffer.

To get a buffer that is never shorter than a specific value, and as
little as possible longer, call first _min, then _near.


Best regards,
Clemens



More information about the MPlayer-dev-eng mailing list