Bugfix: Fix resampling when client and slave both use format float
diff mbox

Message ID BLU0-SMTP175CCD2DD79CCAB8548A5C5E2800@phx.gbl
State Accepted
Delegated to: Takashi Iwai
Headers show

Commit Message

Maarten Baert Feb. 26, 2014, 1:32 p.m. UTC
On 26/02/14 08:28, Takashi Iwai wrote:
> It's not applicable via git am. Please resubmit with the right format
> (that is cleanly applied via git am). 
Sorry, this one should work.

Comments

Takashi Iwai Feb. 26, 2014, 1:40 p.m. UTC | #1
At Wed, 26 Feb 2014 14:32:51 +0100,
Maarten Baert wrote:
> 
> On 26/02/14 08:28, Takashi Iwai wrote:
> > It's not applicable via git am. Please resubmit with the right format
> > (that is cleanly applied via git am). 
> Sorry, this one should work.

Thanks, applied now.


Takashi

Patch
diff mbox

From 3a576686760ec6bb76892443e3c3c9ed2657bf93 Mon Sep 17 00:00:00 2001
From: Maarten Baert <maarten-baert@hotmail.com>
Date: Wed, 26 Feb 2014 14:23:45 +0100
Subject: [PATCH] snd_pcm_plug_change_format: 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>
---
 src/pcm/pcm_plug.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/pcm/pcm_plug.c b/src/pcm/pcm_plug.c
index fa84eaa..ede9c15 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
-- 
1.9.0