From 22dc53a906f3550b4ad0ce82684d98228d95713c Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 28 Apr 2014 16:57:18 +0200 Subject: [PATCH] Workaround for aoss + dmix with unaligned rates When an OSS stream is setup (e.g. two periods) with a rate that doesn't align with the fixed rate of the slave PCM, dmix can't establish the hw_params properly. As a dirty workaround, set either only min or max periods so that they don't conflict with each other. Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=874342 Signed-off-by: Takashi Iwai --- alsa/pcm.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/alsa/pcm.c b/alsa/pcm.c index fdf9933..c23d042 100644 --- a/alsa/pcm.c +++ b/alsa/pcm.c @@ -263,10 +263,11 @@ static int oss_dsp_hw_params(oss_dsp_t *dsp) if (err < 0) return err; periods_min = 2; - err = snd_pcm_hw_params_set_periods_min(pcm, hw, &periods_min, 0); - if (err < 0) - return err; - if (dsp->maxfrags > 0) { + if (!dsp->maxfrags) { + err = snd_pcm_hw_params_set_periods_min(pcm, hw, &periods_min, 0); + if (err < 0) + return err; + } else { unsigned int periods_max = periods_min > dsp->maxfrags ? periods_min : dsp->maxfrags; err = snd_pcm_hw_params_set_periods_max(pcm, hw, -- 2.47.1