All of lore.kernel.org
 help / color / mirror / Atom feed
* LADSPA plugin segfault patch
@ 2003-06-13 21:52 David Honeywell
  2003-06-14  7:33 ` Jaroslav Kysela
  0 siblings, 1 reply; 3+ messages in thread
From: David Honeywell @ 2003-06-13 21:52 UTC (permalink / raw)
  To: alsa-devel

I have been experimenting with LADSPA plugins available from 
http://plugin.org.uk/ and other sources.  I found that many of the 
plugins caused a segfault during pcm playback, while some did not.  I 
traced the problem to LADSPA plugins which do not have an activate() 
function.  Apparently this function can be present, or set to NULL.

I found that whenever activate() or deactivate() are called in 
pcm_ladspa.c, a sanity check is performed before calling the function. 
EXCEPT in one instance.  When I added the sanity check to that instance, 
the segfaults disappeared and all of the plugins that I tried worked. 
Here is a patch for alsa-lib/src/pcm/pcm_ladspa.c:


--- pcm_ladspa.orig	2003-06-13 13:34:58.000000000 -0700
+++ pcm_ladspa.c	2003-06-13 13:32:02.000000000 -0700
@@ -412,7 +412,8 @@
  				return -EINVAL;
  			}
  			list_add_tail(&instance->list, &plugin->instances);
-			plugin->desc->activate(instance->handle);
+			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, instance, idx);
  				if (err < 0) {


For anyone that's interested, my asound.conf looks like this:

pcm.pitch
{
    type ladspa
    slave.pcm "plughw:0,0"
    path "/usr/local/lib/ladspa"
    plugins
    [
       {
          label amPitchshift
          input
          {
             controls [ 1.059463 3 ]
          }
       }
    ]
}

There's one other problem that I haven't been able to solve yet.  When I 
use the latest ALSA library, I get error messages that complain about 
the version whenever I try to play pcm through the plugin:

ALSA lib dlmisc.c:107:(snd_dlsym_verify) unable to verify version for 
symbol ladspa_descriptor

Compiling --with-versioned= yes or no makes no difference in this case.
The only way I have been able to get around this problem is to use an 
old ALSA library (I'm currently using 0.9.0rc6).  I have tried many 
versions of the library.  The problem seems to have started with CVS 
version 1.11 of pcm_ladspa.c.  Version 1.10 uses dlopen(), dlclose(), 
and dlsym(), while version 1.11 uses snd_dlopen(), snd_dlclose(), and 
snd_dlsym().  This appears to be the only difference between the two 
versions.  Any help on this issue would be greatly appreciated, as I'd 
like to use the most up-to-date library.



-------------------------------------------------------
This SF.NET email is sponsored by: eBay
Great deals on office technology -- on eBay now! Click here:
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: LADSPA plugin segfault patch
  2003-06-13 21:52 LADSPA plugin segfault patch David Honeywell
@ 2003-06-14  7:33 ` Jaroslav Kysela
  2003-06-25 18:02   ` David Honeywell
  0 siblings, 1 reply; 3+ messages in thread
From: Jaroslav Kysela @ 2003-06-14  7:33 UTC (permalink / raw)
  To: David Honeywell; +Cc: alsa-devel@lists.sourceforge.net

On Fri, 13 Jun 2003, David Honeywell wrote:

> I have been experimenting with LADSPA plugins available from 
> http://plugin.org.uk/ and other sources.  I found that many of the 
> plugins caused a segfault during pcm playback, while some did not.  I 
> traced the problem to LADSPA plugins which do not have an activate() 
> function.  Apparently this function can be present, or set to NULL.
> 
> I found that whenever activate() or deactivate() are called in 
> pcm_ladspa.c, a sanity check is performed before calling the function. 
> EXCEPT in one instance.  When I added the sanity check to that instance, 
> the segfaults disappeared and all of the plugins that I tried worked. 
> Here is a patch for alsa-lib/src/pcm/pcm_ladspa.c:
> 
> 
> --- pcm_ladspa.orig	2003-06-13 13:34:58.000000000 -0700
> +++ pcm_ladspa.c	2003-06-13 13:32:02.000000000 -0700
> @@ -412,7 +412,8 @@
>   				return -EINVAL;
>   			}
>   			list_add_tail(&instance->list, &plugin->instances);
> -			plugin->desc->activate(instance->handle);
> +			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, instance, idx);
>   				if (err < 0) {
> 

Thanks. Added to CVS.

> There's one other problem that I haven't been able to solve yet.  When I 
> use the latest ALSA library, I get error messages that complain about 
> the version whenever I try to play pcm through the plugin:
> 
> ALSA lib dlmisc.c:107:(snd_dlsym_verify) unable to verify version for 
> symbol ladspa_descriptor
> 
> Compiling --with-versioned= yes or no makes no difference in this case.
> The only way I have been able to get around this problem is to use an 
> old ALSA library (I'm currently using 0.9.0rc6).  I have tried many 
> versions of the library.  The problem seems to have started with CVS 
> version 1.11 of pcm_ladspa.c.  Version 1.10 uses dlopen(), dlclose(), 
> and dlsym(), while version 1.11 uses snd_dlopen(), snd_dlclose(), and 
> snd_dlsym().  This appears to be the only difference between the two 
> versions.  Any help on this issue would be greatly appreciated, as I'd 
> like to use the most up-to-date library.

Using snd_dl*() function in LADSPA is broken. They do own versioning for 
internal functions which is not applicable to external code like LADSPA 
plugins. It should be fixed in CVS. Thank you for notice.

						Jaroslav

-----
Jaroslav Kysela <perex@suse.cz>
Linux Kernel Sound Maintainer
ALSA Project, SuSE Labs



-------------------------------------------------------
This SF.NET email is sponsored by: eBay
Great deals on office technology -- on eBay now! Click here:
http://adfarm.mediaplex.com/ad/ck/711-11697-6916-5

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: LADSPA plugin segfault patch
  2003-06-14  7:33 ` Jaroslav Kysela
@ 2003-06-25 18:02   ` David Honeywell
  0 siblings, 0 replies; 3+ messages in thread
From: David Honeywell @ 2003-06-25 18:02 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: alsa-devel

Jaroslav Kysela wrote:
> Using snd_dl*() function in LADSPA is broken. They do own versioning for 
> internal functions which is not applicable to external code like LADSPA 
> plugins. It should be fixed in CVS. Thank you for notice.

I just tested the latest CVS snapshot (2003-06-25) with the LADSPA 
plugins that were previously causing trouble.  The segfault and version 
errors are fixed, but now there is no sound.  Is this a known issue? 
Using alsa-lib-0.9.0rc6 still works fine with everything else the same.

Here is my asound.conf:

pcm.pitch
{
     type ladspa
     slave.pcm "plughw:0,0"
     path "/usr/local/lib/ladspa"
     plugins
     [
        {
           label amPitchshift
           input
           {
              controls [ 1.059463 3 ]
           }
        }
     ]
}

In my player, I use device.pcm_device = "plug:pitch".  Any ideas?

-- 
David Honeywell
PianoDisc Design Engineer
(916) 567-9999 ext. 181
www.pianodisc.com
davidh@pianodisc.com
(PGP Public Key Available)



-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-06-25 18:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-06-13 21:52 LADSPA plugin segfault patch David Honeywell
2003-06-14  7:33 ` Jaroslav Kysela
2003-06-25 18:02   ` David Honeywell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.