diff options
author | Maarten Baert <maarten-baert@hotmail.com> | 2014-02-26 14:23:45 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-02-26 14:39:18 +0100 |
commit | 2da7b0c2c194a457de9d9a1a9b93c47e2dad1507 (patch) | |
tree | 510c10f8024bb7c0ec418bcef201d77e8790e57c | |
parent | b669b50de2c0d0f18db924a4a5b556ffcc094421 (diff) | |
download | alsa-lib-2da7b0c2c194a457de9d9a1a9b93c47e2dad1507.tar.gz |
pcm: Insert linear-to-float conversion when rate or channel count is incorrect
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>
-rw-r--r-- | src/pcm/pcm_plug.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/pcm/pcm_plug.c b/src/pcm/pcm_plug.c index fa84eaac..ede9c152 100644 --- a/src/pcm/pcm_plug.c +++ b/src/pcm/pcm_plug.c @@ -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 |