title: Pulseaudio sound streaming for multiple users on tcp using Guacamole VNC
body: <p>Ubuntu 14.04. I have PulseAudio running as daemon, and configured to do streaming. In <code>/etc/pulse/default.pa</code> I have added the following, to accept TCP connections:</p>
  
  <pre><code>load-module module-native-protocol-tcp auth-ip-acl=192.168.1.0/24 auth-anonymous=1
  </code></pre>
  
  <p>Guacamole's VNC support obtains audio through a connection to the PulseAudio server. See relevant article on <a href="http://guac-dev.org/doc/gug/configuring-guacamole.html" rel="nofollow">Guacamole Audio support (via PulseAudio)</a>.
  I can get sound to stream from one VNC desktop, but not more than one, despite enabling for multiple VNC connections (these are different connections) in <code>/etc/guacamole/user-mapping.xml</code>. For example:</p>
  
  <pre><code>&lt;!-- First user --&gt;
  &lt;authorize username="user1" password="abcd"&gt;
      &lt;connection name="vnc"&gt;
          &lt;protocol&gt;vnc&lt;/protocol&gt;
          &lt;param name="hostname"&gt;localhost&lt;/param&gt;
          &lt;param name="port"&gt;5903&lt;/param&gt;
          &lt;param name="password"&gt;abcd&lt;/param&gt;
          &lt;param name="enable-audio"&gt;true&lt;/param&gt;
          &lt;param name="audio-servername"&gt;localhost&lt;/param&gt;
      &lt;/connection&gt;
  &lt;/authorize&gt;
  
  &lt;!-- Second user --&gt;
  &lt;authorize username="user2" password="abcd"&gt;
      &lt;!-- First authorized connection --&gt;
      &lt;connection name="vnc"&gt;
          &lt;protocol&gt;vnc&lt;/protocol&gt;
          &lt;param name="hostname"&gt;localhost&lt;/param&gt;
          &lt;param name="port"&gt;5904&lt;/param&gt;
          &lt;param name="password"&gt;abcd&lt;/param&gt;
          &lt;param name="enable-audio"&gt;true&lt;/param&gt;
          &lt;param name="audio-servername"&gt;localhost&lt;/param&gt;
      &lt;/connection&gt;
  &lt;/authorize&gt;
  </code></pre>
  
  <p>PulseAudio is accepting connections on port 4713. </p>
  
  <pre><code>$ netstat -ln | grep 4713
  tcp        0      0 0.0.0.0:4713            0.0.0.0:*               LISTEN
  tcp6       0      0 :::4713                 :::*                    LISTEN
  </code></pre>
  
  <p>Does PulseAudio handle multiple Guacamole VNC users?</p>
  
  <p>Since Guacamole logs to /var/log/syslog, I've isolated the logs for two instances of connections. These are the logs.</p>
  
  <p>First connection is a user called guacamole_guest, and it has no sound. </p>
  
  <pre><code>Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Protocol "vnc" selected
  Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Connection ID is "$299e5678-59de-4dbd-9408-ad256785f732"
  Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: VNC server supports protocol version 3.8 (viewer 3.8)
  Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: We have 2 security types to read
  Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: 0) Received security type 2
  Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Selecting security type 2 (0/2 in the list)
  Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: 1) Received security type 16
  Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Selected Security Scheme 2
  Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: VNC authentication succeeded
  Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Desktop name "guacamole_guest's X desktop (lubuntu-ThinkCentre-M58p:3)"
  Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Connected to VNC server, using protocol version 3.8
  Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: VNC server default format:
  Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]:   32 bits per pixel.
  Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]:   Least significant byte first in each pixel.
  Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]:   TRUE colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0
  Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Audio will be encoded as audio/ogg
  Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Starting audio stream
  Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Connecting to PulseAudio...
  Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Starting client
  Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Authorizing PulseAudio connection...
  Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Sending client name...
  Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: PulseAudio now ready
  Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Will use default sink: "auto_null"
  Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: Starting streaming from "Dummy Output"
  Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: PulseAudio stream being created...
  Oct 23 02:31:23 lubuntu-ThinkCentre-M58p guacd[18848]: PulseAudio stream now ready
  Oct 23 02:31:33 lubuntu-ThinkCentre-M58p guacd[18848]: Client disconnected
  Oct 23 02:31:33 lubuntu-ThinkCentre-M58p guacd[18848]: Audio stream finished
  Oct 23 02:31:33 lubuntu-ThinkCentre-M58p kernel: [1207939.582306] guacd[18848]: segfault at 67452305 ip b6b7ce15 sp bfd99cc0 error 4 in libguac-client-vnc.so.0.0.0[b6b73000+e000]
  </code></pre>
  
  <p>Second user is called lubuntu. It has sound.</p>
  
  <pre><code>Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Protocol "vnc" selected
  Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Connection ID is "$6344d2fb-c5fe-4073-82d7-88dea358b8f6"
  Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: VNC server supports protocol version 3.8 (viewer 3.8)
  Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: We have 2 security types to read
  Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: 0) Received security type 2
  Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Selecting security type 2 (0/2 in the list)
  Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: 1) Received security type 16
  Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Selected Security Scheme 2
  Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: VNC authentication succeeded
  Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Desktop name "lubuntu's X desktop (lubuntu-ThinkCentre-M58p:2)"
  Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Connected to VNC server, using protocol version 3.8
  Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: VNC server default format:
  Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]:   32 bits per pixel.
  Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]:   Least significant byte first in each pixel.
  Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]:   TRUE colour: max red 255 green 255 blue 255, shift red 16 green 8 blue 0
  Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Audio will be encoded as audio/ogg
  Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Starting audio stream
  Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Connecting to PulseAudio...
  Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Authorizing PulseAudio connection...
  Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Sending client name...
  Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Starting client
  Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: PulseAudio now ready
  Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Will use default sink: "auto_null"
  Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: Starting streaming from "Dummy Output"
  Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: PulseAudio stream being created...
  Oct 23 02:31:37 lubuntu-ThinkCentre-M58p guacd[18871]: PulseAudio stream now ready
  Oct 23 02:31:43 lubuntu-ThinkCentre-M58p guacd[18871]: Client disconnected
  Oct 23 02:31:43 lubuntu-ThinkCentre-M58p guacd[18871]: Audio stream finished
  Oct 23 02:31:43 lubuntu-ThinkCentre-M58p kernel: [1207949.566374] guacd[18871]: segfault at 67452305 ip b6b7ce15 sp bfd99cc0 error 4 in libguac-client-vnc.so.0.0.0[b6b73000+e000]
  </code></pre>
  
  <p>On the surface they look the same. Not sure where to proceed. The segfaults don't look good, but they happen in both cases.</p>