Pulseaudio是怎么启动的?

Fedora每日一篇
PluseAudio在Fedora 8的时候作为系统标准的声音处理组件被引入,那么它在GNOME环境下是如何随GNOME的会话启动的呢?
先看一下GNOME会话的启动控制文件,gnome-session是GNOME会话的实际程序,这个程序的任务是在GNOME桌面启动之时启动已被配置为需要启动的一组程序(当然可以是任意的需要的程序)。主要配置文件/usr/share/gnome/default.session,该文件配置了默认的启动程序列表,这个文件的内容看起来是这样的,
# This is the default session that is launched if the user doesn't
# already have a session.
# The RestartCommand specifies the command to run from the $PATH.
# The Priority determines the order in which the commands are started
# (with Priority = 0 first) and defaults to 50.
# The id provides a name that is unique within this file and passed to the
# app as the client id which it must use to register with gnome-session.
# The clients must be numbered from 0 to the value of num_clients - 1.

[Default]
num_clients=5
0,id=default0
0,Priority=60
0,RestartCommand=pam-panel-icon --sm-client-id default0
1,id=default1
1,Priority=10
1,RestartCommand=gnome-wm --default-wm gnome-wm --sm-client-id default1
2,id=default2
2,Priority=40
2,RestartCommand=gnome-panel --sm-client-id default2
3,id=default3
3,Priority=40
3,RestartCommand=nautilus --no-default-window --sm-client-id default3
4,id=default4
4,Priority=40
4,RestartCommand=gnome-volume-manager --sm-client-id default4
从中我们可以清楚的看到没有PulseAudio相关的程序(其中的gnome-volume-manager是GNOME文件卷管理器,负责自动挂载文件系统),除了这个文件之外,gnome-session还从一些.desktop文件中获取启动程序的信息,这些文件列于/usr/share/gnome/autostart中和~/.config/autostart中。其实可以发现PulseAudio也不在这些目录中。
那么究竟PulseAudio是如何启动的呢?从ps输出来看,gnome-session是它的父进程,strace的结果也可以证明。
再从RPM包的情况来看一下,
$ rpm -qa|egrep '^pulse'
pulseaudio-libs-0.9.8-5.fc8
pulseaudio-module-x11-0.9.8-5.fc8
pulseaudio-0.9.8-5.fc8
pulseaudio-libs-glib2-0.9.8-5.fc8
pulseaudio-utils-0.9.8-5.fc8
pulseaudio-core-libs-0.9.8-5.fc8
pulseaudio-module-gconf-0.9.8-5.fc8
pulseaudio-esound-compat-0.9.8-5.fc8
pulseaudio-libs-0.9.8-5.fc8
这些是Fedora 8的情况,
esound服务(daemon)是esd,旧声音服务,目前在Pulse架构下有一个哑的esd来做到兼容性的需要,包含在包pulseaudio-esound-compat里,

$ rpm -ql pulseaudio-esound-compat
/usr/bin/esd
/usr/bin/esdcompat
/usr/share/man/man1/esdcompat.1.gz

$ file /usr/bin/esd*
/usr/bin/esd: symbolic link to `esdcompat'
/usr/bin/esdcompat: Bourne shell script text executable
/usr/bin/esd-config: Bourne shell script text executable

esdcompat的手册页(manpage)告诉我们这方面的更多细节,

esdcompat是一个兼容性脚本,使用和ESD声音服务一样的参数(esd daemon)但实际上是用正确的参数设置启动PulseAudio声音服务程序,这是使用PulseAudio平滑的取代ESD的需要,以便gnome-session能够以PulseAudio来取代ESD。

这个就给了我们一个最终的交代,gnome-session自动启动esd,而哑esd正是张冠李戴的正确启动pulseaudio的关键!

Comments

Popular posts from this blog

RPM Build Tips!

关于.rpmnew和.rpmsave文件

Linux block device commands