使用Guacamole VNC在tcp上为多个用户提供Pulseaudio声音流

时间:2015-10-23 04:05:25

标签: vnc pulseaudio guacamole

Ubuntu 14.04。我将PulseAudio作为守护进程运行,并配置为进行流式传输。在/etc/pulse/default.pa我添加了以下内容,以接受TCP连接:

load-module module-native-protocol-tcp auth-ip-acl=192.168.1.0/24 auth-anonymous=1

Guacamole的VNC支持通过与PulseAudio服务器的连接获得音频。请参阅Guacamole Audio support (via PulseAudio)的相关文章。 尽管在/etc/guacamole/user-mapping.xml中启用了多个VNC连接(这些是不同的连接),但我可以从一个VNC桌面流式传输声音,但不能超过一个。例如:

<!-- First user -->
<authorize username="user1" password="abcd">
    <connection name="vnc">
        <protocol>vnc</protocol>
        <param name="hostname">localhost</param>
        <param name="port">5903</param>
        <param name="password">abcd</param>
        <param name="enable-audio">true</param>
        <param name="audio-servername">localhost</param>
    </connection>
</authorize>

<!-- Second user -->
<authorize username="user2" password="abcd">
    <!-- First authorized connection -->
    <connection name="vnc">
        <protocol>vnc</protocol>
        <param name="hostname">localhost</param>
        <param name="port">5904</param>
        <param name="password">abcd</param>
        <param name="enable-audio">true</param>
        <param name="audio-servername">localhost</param>
    </connection>
</authorize>

PulseAudio正在接受端口4713上的连接。

$ netstat -ln | grep 4713
tcp        0      0 0.0.0.0:4713            0.0.0.0:*               LISTEN
tcp6       0      0 :::4713                 :::*                    LISTEN

PulseAudio是否处理多个Guacamole VNC用户?

由于Guacamole登录到/ var / log / syslog,我已经隔离了两个连接实例的日志。这些是日志。

第一个连接是一个名为guacamole_guest的用户,它没有声音。

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]

第二个用户叫做lubuntu。它有声音。

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]

表面看起来一样。不知道从哪里开始。段错误看起来不太好,但在两种情况下都会发生。

1 个答案:

答案 0 :(得分:1)

  

PulseAudio是否处理多个Guacamole VNC用户?

PulseAudio不会知道Guacamole的VNC连接。 Guacamole将来自PulseAudio的音频流与来自VNC的图形流相结合,但VNC和PulseAudio连接完全独立。

Guacamole 可以处理不同用户/连接的PulseAudio流,但这些流必须来自不同的主机。这是因为当代表VNC连接连接到PulseAudio时,Guacamole将执行以下操作:

  1. 建立与audio-servername描述的PulseAudio服务器的TCP连接。
  2. 围绕默认接收器创建监视器源,并流式传输接收到的音频数据包。
  3. 由于localhost处的PulseAudio服务器在两个连接中都是相同的PulseAudio服务器,并且只有一个默认接收器,因此在两种情况下都会听到来自同一接收器的音频。

      

    第一个连接是一个名为guacamole_guest的用户,它没有声音。 ......第二个用户叫做lubuntu。它有声音。

    虽然有趣,但您只在一个连接中听到音频的事实可能更多地与在PulseAudio中如何路由音频有关。我确信有一个原因,但找出原因并不能解决你的问题。 与您的两个VNC连接关联的两个PulseAudio连接保证在您的情况下是相同的

    如果您希望在同一硬件上托管多个用户的桌面,我建议使用VirtualBox或KVM之类的东西将每个用户的桌面放在虚拟机中。这将为您提供更好的用户间隔离,以及相应PulseAudio服务器的唯一网络地址。

      

    段错误看起来不太好,但在两种情况下都会发生。

    确实,guacd肯定不应该是segfaulting。如果您可以可靠地重现段错误,最好的做法是为项目生成错误报告。在段错误的情况下,执行此操作的说明有些涉及,但是必须确定段错误发生的位置和方式:

    1. 确保guacd已死(因此我们可以在调试器下再次启动它)。

      $ killall guacd
      guacd: no process found
      $ 
      
    2. 在gdb下加载guacd,预加载失败协议的插件。

      $ LD_PRELOAD=/usr/local/lib/libguac-client-vnc.so gdb /usr/local/sbin/guacd
      GNU gdb (GDB) 7.4.1-debian
      Copyright (C) 2012 Free Software Foundation, Inc.
      ...
      (gdb)
      
    3. 告诉gdb遵循下一个子进程(guacd创建一个新的子进程来隔离和处理每个新连接)。

      (gdb) set follow-fork-mode child
      (gdb)
      
    4. 在gdb中运行guacd,使用-L debug在guacd中启用调试级别日志记录。

      (gdb) run -L debug
      Starting program: /usr/local/sbin/guacd 
      [Thread debugging using libthread_db enabled]
      Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
      guacd[29589]: INFO:     Guacamole proxy daemon (guacd) version 0.9.8 started
      guacd[29589]: DEBUG:    Unable to bind socket to host ::1, port 4822: Address family not supported by protocol
      guacd[29589]: DEBUG:    Successfully bound socket to host 127.0.0.1, port 4822
      guacd[29589]: INFO:     Listening on host 127.0.0.1, port 4822
      ...
      
    5. 重现问题。一旦发生,您将被带回gdb提示符。从gdb获取回溯:

      (gdb) bt
      
    6. 发送结果回溯以及如何在JIRA of the Guacamole project的新问题中重现问题的说明。