diff mbox

[alsa-lib] pcm: route: Fix use_getput flag computation for 3 byte formats

Message ID 450a039b-3038-f240-cdca-acafdfbb3b33@maciej.szmigiero.name (mailing list archive)
State New, archived
Headers show

Commit Message

Maciej S. Szmigiero Nov. 20, 2017, 12:12 p.m. UTC
Commit de63b942acf520 ("pcm: route: Use get/put labels for all 3 byte formats")
wanted to make the route plugin use get / put labels not only for 24-bit
physical width formats but also for 18 and 20-bit ones.
There was, however, a typo in that commit so a check for these widths
didn't really work.

Let's fix it now.

Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>
---
 src/pcm/pcm_route.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Takashi Iwai Nov. 20, 2017, 1:31 p.m. UTC | #1
On Mon, 20 Nov 2017 13:12:32 +0100,
Maciej S. Szmigiero wrote:
> 
> Commit de63b942acf520 ("pcm: route: Use get/put labels for all 3 byte formats")
> wanted to make the route plugin use get / put labels not only for 24-bit
> physical width formats but also for 18 and 20-bit ones.
> There was, however, a typo in that commit so a check for these widths
> didn't really work.
> 
> Let's fix it now.
> 
> Signed-off-by: Maciej S. Szmigiero <mail@maciej.szmigiero.name>

Thanks, applied now.


Takashi
diff mbox

Patch

diff --git a/src/pcm/pcm_route.c b/src/pcm/pcm_route.c
index 999a2eed3a25..1f485a8e79f9 100644
--- a/src/pcm/pcm_route.c
+++ b/src/pcm/pcm_route.c
@@ -567,8 +567,8 @@  static int snd_pcm_route_hw_params(snd_pcm_t *pcm, snd_pcm_hw_params_t * params)
 		return err;
 	/* 3 bytes formats? */
 	route->params.use_getput =
-		(snd_pcm_format_physical_width(src_format) + 7) / 3 == 3 ||
-		(snd_pcm_format_physical_width(dst_format) + 7) / 3 == 3;
+		(snd_pcm_format_physical_width(src_format) + 7) / 8 == 3 ||
+		(snd_pcm_format_physical_width(dst_format) + 7) / 8 == 3;
 	route->params.get_idx = snd_pcm_linear_get_index(src_format, SND_PCM_FORMAT_S32);
 	route->params.put_idx = snd_pcm_linear_put_index(SND_PCM_FORMAT_S32, dst_format);
 	route->params.conv_idx = snd_pcm_linear_convert_index(src_format, dst_format);