]> git.alsa-project.org Git - alsa-lib.git/commitdiff
pcm: Insert linear-to-float conversion when rate or channel count is incorrect
authorMaarten Baert <maarten-baert@hotmail.com>
Wed, 26 Feb 2014 13:23:45 +0000 (14:23 +0100)
committerTakashi Iwai <tiwai@suse.de>
Wed, 26 Feb 2014 13:39:18 +0000 (14:39 +0100)
This fixes a bug where snd_pcm_plug_insert_plugins fails when both
client and slave use format float, but the rate or channel count does
not match. I also removed some redundant code.

Signed-off-by: Maarten Baert <maarten-baert@hotmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
src/pcm/pcm_plug.c

index fa84eaacaedc6d344c093d71fc95594e43cdaab4..ede9c1525a7464e436ae6816f86de9c68786a47d 100644 (file)
@@ -522,15 +522,13 @@ static int snd_pcm_plug_change_format(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm_p
                }
 #ifdef BUILD_PCM_PLUGIN_LFLOAT
        } else if (snd_pcm_format_float(slv->format)) {
-               /* Conversion is done in another plugin */
-               if (clt->format == slv->format &&
-                   clt->rate == slv->rate &&
-                   clt->channels == slv->channels)
-                       return 0;
-               cfmt = clt->format;
-               if (snd_pcm_format_linear(clt->format))
+               if (snd_pcm_format_linear(clt->format)) {
+                       cfmt = clt->format;
                        f = snd_pcm_lfloat_open;
-               else
+               } else if (clt->rate != slv->rate || clt->channels != slv->channels) {
+                       cfmt = SND_PCM_FORMAT_S16;
+                       f = snd_pcm_lfloat_open;
+               } else
                        return -EINVAL;
 #endif
 #ifdef BUILD_PCM_NONLINEAR