]> git.alsa-project.org Git - alsa-oss.git/commitdiff
Workaround for aoss + dmix with unaligned rates
authorTakashi Iwai <tiwai@suse.de>
Mon, 28 Apr 2014 14:57:18 +0000 (16:57 +0200)
committerTakashi Iwai <tiwai@suse.de>
Mon, 28 Apr 2014 14:57:18 +0000 (16:57 +0200)
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 <tiwai@suse.de>
alsa/pcm.c

index fdf99337997f9373f173ac64ce882601f8846c96..c23d0423fc86e49ed0ccf566c8d0d49640ae83cd 100644 (file)
@@ -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,