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

使用鳄梨酱VNC在tcp上为多个用户提供Pulseaudio声音流,vnc,pulseaudio,guacamole,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服务器获得音频。请参阅有关的文章。 尽管在/etc/guacamole/user mapping.

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服务器获得音频。请参阅有关的文章。 尽管在
/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是否处理多个鳄梨酱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]
从表面上看,他们看起来是一样的。我不知道该去哪里。SegFault看起来不太好,但在这两种情况下都会发生

PulseAudio是否处理多个鳄梨酱VNC用户

PulseAudio不会知道鳄梨酱的VNC连接。鳄梨酱将把来自PulseAudio的音频流与来自VNC的图形流结合起来,但VNC和PulseAudio连接在其他方面是完全独立的

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

  • 建立到PulseAudio服务器的TCP连接,如
    audio servername
    所述
  • 在默认接收器周围创建一个监视器源,并对接收到的音频数据包进行流式传输
  • 由于位于
    localhost
    的PulseAudio服务器在两个连接中都是相同的PulseAudio服务器,并且只有一个默认接收器,因此在这两种情况下,您将听到来自同一接收器的音频

    第一个连接是一个名为guacamole_guest的用户,它没有声音。。。第二个用户称为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]
    
    有趣的是,您只在一个连接中听到音频的事实可能与音频在PulseAudio中的路由方式有关。我相信这是有原因的,但找出原因并不能解决你的问题。与您的两个VNC连接关联的两个PulseAudio连接保证在您的情况下相同

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

    SegFault看起来不太好,但在这两种情况下都会发生

    事实上,番石榴绝对不应该有缺陷。如果您能够可靠地复制segfault,那么最好的办法就是为项目生成一个bug报告。在segfault的情况下,执行此操作的说明有些复杂,但有必要确定segfault发生的位置和方式:

  • 确保guacd是死的(这样我们可以在调试器下再次启动它)

  • 在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)
    
  • 告诉gdb遵循下一个子进程(guacd创建一个新的子进程来隔离和处理每个新连接)

  • 在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
    ...
    
  • 重现问题。一旦发生,您将返回到gdb提示符。从gdb获取回溯跟踪:

    (gdb) bt
    
  • 发送结果回溯以及如何在中的新问题中重现问题的说明

  • (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
    ...
    
    (gdb) bt