Re: Are ALSA io plugins implemented as threads or does ALSA use fork() ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 19 Mar 2010, Stefan Schoenleitner wrote:

> Hello,
>
> from what I have learned so far ALSA io plugins are implemented as
> shared libraries with their entry point defined with the
> SND_PCM_PLUGIN_DEFINE_FUNC() macro.
>
> However, each plugin instance can only work for either the
> SND_PCM_STREAM_PLAYBACK or SND_PCM_STREAM_CAPTURE stream.
> Hence this is why io plugins supporting playback and capture usually set
> up their callback functions depending on what type of stream is used.
>
> For example in the pulseaudio io plugin, this is done with:
>
> pcm->io.callback = stream == SND_PCM_STREAM_PLAYBACK ?
>     &pulse_playback_callback : &pulse_capture_callback;
>
>
>
>
> * If such a plugin is used for capture AND playback at the same time, it
> seems that two instances of the plugin need to be running, right ?
>
> * Are these instances running as separate processes (i.e. fork()) or are
> they implemented as threads ? How is this implemented internally in the
> ALSA code ?

No forks or threads. Both instances will run in one process with the 
audio application. The plugin code must take core how many pcm instances 
are active and send the appropriate communication file descriptors to 
application for select/poll I/O multiplexing.

 						Jaroslav

-----
Jaroslav Kysela <perex@xxxxxxxx>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux