spice-streaming-agent从官方的定义介绍,是一个运行于guest os中的守护进行,捕捉guest os的视频输出,编码成视频流后通过spice-protocol协议转发给host主机。
1. 安装
spice-streaming-agent源码下载:https://gitlab.freedesktop.org/spice/spice-streaming-agent
它需要spice-protocol >= 0.12.14 , Ubuntu 下 0.12.14可直接下载到,0.12.15也需要源码编译,源码下载:https://gitlab.freedesktop.org/spice/spice-protocol
spice-protocol、spice-streaming-agent的编译:
./autogen.sh
make
sudo make install
注意:执行autogen.sh时,可能由于编译环境原因会缺包,要配好源能及时下载,一般规律是,如果提示缺少jpeg包,那就得下载libjpeg-dev的包,可能不全是这规律,U系可以apt-cache search libjpeg搜一下。
2. host 配置
host服务器端要使用spice-server >= 0.14.1,如果版本没升级,其它都配置了,运行spice-streaming-agent时也会报错:spice-streaming-agent[2223]: Reading message from device failed: read() returned 0, device is closed.
Ubuntu 目前只有0.14.0的deb包,所以需要源码编译,源码下载: https://gitlab.freedesktop.org/spice/spice
spice 0.14.1版本也需要spice-protocol 0.12.15,目前也需要源码编译。
spice-protocol、spice的编译:
./autogen.sh
make
sudo make install
另外,
除了对spice-server 的版本要求外,还需要对虚拟机进行配置,要增加一个类型为 spiceport 的 channel 设备,并命名为org.spice-space.stream.0,由于spice-streaming-agent代码里面定义了这个名字,因而不要随便改写。
以通过virsh用XML文件启虚拟机为例,XML文件中要增加如下段:
<devices>
......
<controller type='virtio-serial' index='0'/>
<channel type='spiceport'>
<source channel='org.spice-space.stream.0'/>
<target type='virtio' name='org.spice-space.stream.0'/>
</channel>
</devices>
如果已经存在了'virtio-serial'的设备,就不必重复添加了,例如已经配置了为spice-vdagent用的‘spicevmc’设备时就已经添加了。
3. 使用
配置好host,以及虚拟机中编译完spice-streaming-agent之后,就会生成spice-streaming-agent的命令,可以直接执行了。
但目前来看,该spice-streaming-agent的使用后效果,是通过视频流在客户端生成了一个display 2,与display 1 是一样的输出,不能响应鼠键。同时测播放视频时,并没有改善播放效果,估计得自己写编解码的插件,到时再看看效果。