diff mbox

[RFC] alsa-lib: Call LADSPA activate after all ports are setup

Message ID 20140317194000.5fa76393@purefruit.fritz.box (mailing list archive)
State Accepted
Headers show

Commit Message

Matthias Larisch March 17, 2014, 6:40 p.m. UTC
Hey there,

I notices mainly swh-plugins (like butterworth_1902) to crash on seek with
mplayer or mpd. This is due to their behaviour on relying on the activate call
after the control inputs are set.

This is not right by LADSPA API description but I see no point in NOT calling
activate as late as possible in alsa-lib.

Comments?

Regards,

Matthias

From f7f5d920c845fc54ffef208f68f568b06e8fadd1 Mon Sep 17 00:00:00 2001
From: Matthias Larisch <mail@matthias-larisch.de>
Date: Mon, 17 Mar 2014 19:37:01 +0100
Subject: [PATCH] call ladspa activate as late as possible to work around wrong
 plugin behaviour

---
 src/pcm/pcm_ladspa.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Takashi Iwai March 25, 2014, 3:43 p.m. UTC | #1
At Mon, 17 Mar 2014 19:40:00 +0100,
Matthias Larisch wrote:
> 
> Hey there,
> 
> I notices mainly swh-plugins (like butterworth_1902) to crash on seek with
> mplayer or mpd. This is due to their behaviour on relying on the activate call
> after the control inputs are set.
> 
> This is not right by LADSPA API description but I see no point in NOT calling
> activate as late as possible in alsa-lib.
> 
> Comments?

I think your patch is OK.  The worst thing would be a regression, but
I see no big risk there.  Could you resubmit with a proper comment and
your sign off?  Thanks.


Takashi

> 
> Regards,
> 
> Matthias
> 
> >From f7f5d920c845fc54ffef208f68f568b06e8fadd1 Mon Sep 17 00:00:00 2001
> From: Matthias Larisch <mail@matthias-larisch.de>
> Date: Mon, 17 Mar 2014 19:37:01 +0100
> Subject: [PATCH] call ladspa activate as late as possible to work around wrong
>  plugin behaviour
> 
> ---
>  src/pcm/pcm_ladspa.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/src/pcm/pcm_ladspa.c b/src/pcm/pcm_ladspa.c
> index 9ce5242..7d1e3df 100644
> --- a/src/pcm/pcm_ladspa.c
> +++ b/src/pcm/pcm_ladspa.c
> @@ -645,8 +645,6 @@ static int snd_pcm_ladspa_allocate_instances(snd_pcm_t *pcm, snd_pcm_ladspa_t *l
>  				return -EINVAL;
>  			}
>  			list_add_tail(&instance->list, &plugin->instances);
> -			if (plugin->desc->activate)
> -				plugin->desc->activate(instance->handle);
>  			if (plugin->policy == SND_PCM_LADSPA_POLICY_DUPLICATE) {
>  				err = snd_pcm_ladspa_connect_plugin_duplicate(plugin, &plugin->input, &plugin->output, instance, idx);
>  				if (err < 0) {
> @@ -664,6 +662,8 @@ static int snd_pcm_ladspa_allocate_instances(snd_pcm_t *pcm, snd_pcm_ladspa_t *l
>  			assert(err >= 0);
>  			err = snd_pcm_ladspa_connect_controls(plugin, &plugin->output, instance);
>  			assert(err >= 0);
> +			if (plugin->desc->activate)
> +				plugin->desc->activate(instance->handle);
>  		}
>  		err = snd_pcm_ladspa_check_connect(plugin, &plugin->input, &instance->input, depth);
>  		if (err < 0)
> -- 
> 1.9.0
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
diff mbox

Patch

diff --git a/src/pcm/pcm_ladspa.c b/src/pcm/pcm_ladspa.c
index 9ce5242..7d1e3df 100644
--- a/src/pcm/pcm_ladspa.c
+++ b/src/pcm/pcm_ladspa.c
@@ -645,8 +645,6 @@  static int snd_pcm_ladspa_allocate_instances(snd_pcm_t *pcm, snd_pcm_ladspa_t *l
 				return -EINVAL;
 			}
 			list_add_tail(&instance->list, &plugin->instances);
-			if (plugin->desc->activate)
-				plugin->desc->activate(instance->handle);
 			if (plugin->policy == SND_PCM_LADSPA_POLICY_DUPLICATE) {
 				err = snd_pcm_ladspa_connect_plugin_duplicate(plugin, &plugin->input, &plugin->output, instance, idx);
 				if (err < 0) {
@@ -664,6 +662,8 @@  static int snd_pcm_ladspa_allocate_instances(snd_pcm_t *pcm, snd_pcm_ladspa_t *l
 			assert(err >= 0);
 			err = snd_pcm_ladspa_connect_controls(plugin, &plugin->output, instance);
 			assert(err >= 0);
+			if (plugin->desc->activate)
+				plugin->desc->activate(instance->handle);
 		}
 		err = snd_pcm_ladspa_check_connect(plugin, &plugin->input, &instance->input, depth);
 		if (err < 0)