From 19e63491821d755e491fe0e6d579bac455c3e8a5 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 2 Jan 2024 11:03:30 +0100 Subject: [PATCH] pcm: plug plugin - fast_ops may be changed when sw_params are set Link: https://github.com/alsa-project/alsa-lib/issues/372 Signed-off-by: Jaroslav Kysela --- src/pcm/pcm_plug.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/pcm/pcm_plug.c b/src/pcm/pcm_plug.c index abf6f1ab9..e5a3a1892 100644 --- a/src/pcm/pcm_plug.c +++ b/src/pcm/pcm_plug.c @@ -1065,6 +1065,18 @@ static int snd_pcm_plug_hw_free(snd_pcm_t *pcm) return err; } +static int snd_pcm_plug_sw_params(snd_pcm_t *pcm, snd_pcm_sw_params_t * params) +{ + snd_pcm_plug_t *plug = pcm->private_data; + snd_pcm_t *slave = plug->gen.slave; + int err = snd_pcm_sw_params(slave, params); + if (err >= 0) { + pcm->fast_ops = slave->fast_ops; + pcm->fast_op_arg = slave->fast_op_arg; + } + return err; +} + static void snd_pcm_plug_dump(snd_pcm_t *pcm, snd_output_t *out) { snd_pcm_plug_t *plug = pcm->private_data; @@ -1078,7 +1090,7 @@ static const snd_pcm_ops_t snd_pcm_plug_ops = { .hw_refine = snd_pcm_plug_hw_refine, .hw_params = snd_pcm_plug_hw_params, .hw_free = snd_pcm_plug_hw_free, - .sw_params = snd_pcm_generic_sw_params, + .sw_params = snd_pcm_plug_sw_params, .channel_info = snd_pcm_generic_channel_info, .dump = snd_pcm_plug_dump, .nonblock = snd_pcm_generic_nonblock,