Skip to contentSkip to conversation

ALSA calls don't work within Mozilla plug-ins

DISCUSSION Olivier Guillion - Myriad 1 participant 2 messages Aug 23, 2011

lore
Share & tools
lore
#0 lore raw

Hi,

I'm trying to develop a Mozilla plug-in that display and plays music scores. The music rendering module uses ALSA for sound (pcm) output.

It seems that, when called from a Mozilla plug-in, any ALSA function that gets a pointer as parameter either crashes or returns wrong values.

I made a very simple test plug-in from the "Basic Plugin" source code provided by Mozilla (I can provide the full project if needed). Here is what happens:

- Calling "snd_asoundlib_version" works

- Calling "snd_device_name_hint" crashes

- If the browser runs in super-user mode (sudo firefox), all works fine.

- If I load the plug-in (which is a shared library) from a program of my own and call the test function, it works.

Does anyone have any idea about what could cause this issue? Could it be related to access rights or memory allocation/mapping?

I'm using:
Ubuntu 11.04
Firefox 6.0
ALSA 1.0.24.1

I'm really stuck here, any advice would be highly appreciated. Thank you,
Olivier

Olivier Guillion
Myriad
26 rue Michel de Montaigne
31200 Toulouse
FRANCE
-------- WebSite -----------
http://www.myriad-online.com
Download here the latest version of our shareware programs, view the online tutorials or get info about Myriad and its activities.
---------------------------------

#1 lore raw

Hi again,

I investigated a bit further, and experienced a strange behaviour on other function calls, that could be a clue to understand what happens.

When trying to use the default PCM output, functions like snd_pcm_hw_params_get_buffer_size don't work as expected when called from within the Mozilla plug-in.

For instance:

val=12345; err=snd_pcm_hw_params_get_buffer_time(hwparams,&val,NULL);

should return: err=0 , val=time previously set

Quoted 1 line

From within the plugin, it returns:

err=733007751
val remains unchanged (12345).

I took a look at the ALSA source code and I can't figure out how the "val" parameter can remain untouched.

Any idea?

Olivier

---- Original message ----

Quoted 29 lines

I'm trying to develop a Mozilla plug-in that display and plays music scores. The music rendering module uses ALSA for sound (pcm) output.

It seems that, when called from a Mozilla plug-in, any ALSA function that gets a pointer as parameter either crashes or returns wrong values.

I made a very simple test plug-in from the "Basic Plugin" source code provided by Mozilla (I can provide the full project if needed). Here is what happens:

- Calling "snd_asoundlib_version" works

- Calling "snd_device_name_hint" crashes

- If the browser runs in super-user mode (sudo firefox), all works fine.

- If I load the plug-in (which is a shared library) from a program of my own and call the test function, it works.

Does anyone have any idea about what could cause this issue? Could it be related to access rights or memory allocation/mapping?

I'm using:
Ubuntu 11.04
Firefox 6.0
ALSA 1.0.24.1

I'm really stuck here, any advice would be highly appreciated. Thank you,
Olivier