From 4b26b779a13dfb226babb15af249bf3ed18dc153 Mon Sep 17 00:00:00 2001 From: Clemens Ladisch Date: Mon, 3 May 2004 10:03:57 +0000 Subject: [PATCH] fix default buffer time setting when maximum buffer time is less than 250 ms --- aplay/aplay.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/aplay/aplay.c b/aplay/aplay.c index d7ad0fb..1e48310 100644 --- a/aplay/aplay.c +++ b/aplay/aplay.c @@ -852,8 +852,13 @@ static void set_params(void) } } rate = hwparams.rate; - if (buffer_time == 0 && buffer_frames == 0) - buffer_time = 500000; + if (buffer_time == 0 && buffer_frames == 0) { + err = snd_pcm_hw_params_get_buffer_time_max(params, + &buffer_time, 0); + assert(err >= 0); + if (buffer_time > 500000) + buffer_time = 500000; + } if (period_time == 0 && period_frames == 0) { if (buffer_time > 0) period_time = buffer_time / 4;