[Lxc-users] LXC - ALSA & Audio in container

Tony Su tonysu at su-networking.com
Fri Aug 16 18:56:25 UTC 2013


Without directly answering your Q,

I'm a bit bemused by your absolute rejection of PulseAudio. I've
experienced some problems with it in the past, and I fully recognize
that it's possible to have a bad experience (I have had, also) but for
the past couple years now I've also watched it evolve. Despite early
problems, today I am perfectly happy with PulseAudio runnin on my
distro (openSUSE 12.3).

The problem with ALSA only is that your Q and any responses will
likely be <very> specific to your hardware and the specific distro
you're running. I don't know why but have glimpsed how incredibly
complex it is to support multimedia in Linux at the sub-system (eg
ALSA and below) level.

Pulseaudio is an attempt to build on top of ALSA instead of replacing
(again, considering the complexity, one would wonder if some day it
should be replaced for that reason alone although it would be a very
big undertaking with considerable risk). When it works, Pulseaudio is
supposed to provide a simpler, somewhat more common way of managing
ALSA and other multimedia subsystems.

So, I would suggest that any problems you may have had with Pulseaudio
is likely related to

- The quality of support by your chosen Distro (eg Kubuntu in your case)
- The version of Pulseaudio (v3.x which has been widely deployed for
many months is much more capable than v2.x)

So, for instance if you haven't tested Pulseaudio within the past
5mths or so (maybe even more recently) I would recommend you take
another look to see if works better.

IMO,
Tony






On Thu, Aug 15, 2013 at 11:32 AM, TuxRaiderPen
<tuxraiderpen at wpascanner.com> wrote:
> In my quest to expand LXC use  beyond my current use and possibly solve a
> little niche item for myself...
>
> After seeing a thread about using a certain VOIP/web cam package inside a LXC
> conatiner I am curious about how this might play out for my little area.
>
> So...while using something like screen in some cases or any or all might be
> simpler and less cumbersome solution... LXC offers a little bit more of a
> regimented and segmented method whereby each little operation is in its own
> little world (container)....
>
> The thread about the the VOIP/webcam program mentioned about giving access to
> devices....
>
> With that in mind...and one other caveat pulseaudio is OUT, VERBOTEN,
> PROHIBITED, WILL NOT TOUCH MY SYSTEMS EVER! This is one of the first things I
> remove... it just doesn't work.
>
> Since another thread mentions that sharing an ALSA device is not going to work
> and would violate the above..
>
> http://www.jonnor.com/2010/03/hardware-passthrough-in-lxc-or-running-a-
> desktop-in-a-cgroup/
>
> http://www.mail-archive.com/lxc-users@lists.sourceforge.net/msg01107.html
>
> Ok... having each container have its own little USB audio device is fine..
>
> So what needs to be in the LXC container conf to allow this... I reviewed one
> for arch... but I don't use that, and it is honestly above my pay grade...
>
> http://pastebin.com/yjDMLppn
>
> Setup:
>
> LXC Host Kubuntu 12.04 LTR ALSA ONLY! LXC 0.7.5 minimum
>
> LXC containers would be the standard
>
> lxc-create -n Audio1 -t ubuntu
> lxc-create -n Audio2 -t ubuntu
>
> Where the HOST audio -> LXC HOST - No change HW: 0,1
>
> Audio1 = ALSA HW 1,1
> Audio2= ALSA HW 2,1
> etc...
>
> If there was a chance to use the HOST audio device ala :
>
> /etc/asound.conf
> pcm.onboard{
>     type hw
>     card 0
> }
> ctl.onboard {
>     type hw
>     card 0
> }
> ### Dsnoop both channels
> pcm.dsnoop_onboard {
>     type dsnoop
>     ipc_key 32
>     slave {
>         pcm "onboard"
>         channels 2
>         period_size 320
>         rate 48000
>         buffer_size 8192
>         format S32_LE
>     }
>     bindings {
>         0 0
>         1 1
>     }
> }
> ### Dsnoop splited channels
> pcm.onboard_left {
>      type dsnoop
>      ipc_key 32
>      slave {
>          pcm "onboard"
>          channels 2
>      }
>      bindings.0  0
> }
>
> pcm.onboard_right {
>      type dsnoop
>      ipc_key 32
>      slave {
>          pcm "onboard"
>          channels 2
>      }
>      bindings.0  1
> }
>
> ### PLUGS ##
> ### used with darkice
> ### device = plug:plug_onboard_left
> pcm.plug_onboard_left{
>         type route
>         slave.pcm "onboard_left"
>         slave.channels 1
>         ttable.0.0 1
> }
> pcm.plug_onboard_right{
>         type route
>         slave.pcm "onboard_right"
>         slave.channels 1
>         ttable.0.0 1
> }
>
> where then
>
> plug_onboard_left = mic in on LXC Audio1
> plug_onboard_right = mic in on LXC Audio2
>
> and if I were to do the following (untested)
>
> pcm.onboard{
>     type hw
>     card 1
> }
> ctl.onboard {
>     type hw
>     card 1
> }
>
> create say pcm.plug_onboard_rt and pcm_plug_onboard_lt etc
>
> where
> plug_onboard_rt = mic in ALSA LXC Audio3
> pcm_plug_onboard_lt = mic in ALSA LXC Audio4
> etc...
>
> Any one doing any routing of sound devices to LXC containers ?? ?
>
> Thanks in advance.
>
>
>
>
> ------------------------------------------------------------------------------
> Get 100% visibility into Java/.NET code with AppDynamics Lite!
> It's a free troubleshooting tool designed for production.
> Get down to code-level detail for bottlenecks, with <2% overhead.
> Download for free and get started troubleshooting in minutes.
> http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
> _______________________________________________
> Lxc-users mailing list
> Lxc-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-users




More information about the lxc-users mailing list