如何在 Ubuntu 9.04 中以实时优先级运行 pulseaudio?

如何在 Ubuntu 9.04 中以实时优先级运行 pulseaudio?

有时候我声音断断续续所以我考虑以实时优先级运行 pulseaudio。但是当我尝试这样做时,Ubuntu 不允许我这样做。

$ pulseaudio -vvv --start --realtime=1
D: main.c: Started as real root: no, suid root: yes
I: main.c: PolicyKit refuses acquire-high-priority privilege.
I: main.c: PolicyKit refuses acquire-real-time privilege.
I: main.c: Called SUID root and real-time and/or high-priority scheduling
   was requested in the configuration. However, we lack the necessary privileges:
I: main.c: We are not in group 'pulse-rt', PolicyKit refuse to grant us the 
   requested privileges and we have no increase RLIMIT_NICE/RLIMIT_RTPRIO 
   resource limits.
I: main.c: For enabling real-time/high-priority scheduling please acquire 
   the appropriate PolicyKit privileges, or become a member of 'pulse-rt', 
   or increase the RLIMIT_NICE/RLIMIT_RTPRIO resource limits for this user.
I: main.c: setrlimit(RLIMIT_NICE, (31, 31)) failed: Operation not permitted
I: main.c: setrlimit(RLIMIT_RTPRIO, (9, 9)) failed: Operation not permitted
D: main.c: Can realtime: no, can high-priority: no
D: main.c: Can realtime: no, can high-priority: no
I: main.c: Daemon startup successful.

我是 pulse-rt 小组的成员

$ sudo adduser vava 'pulse-rt'
The user `vava' is already a member of `pulse-rt'.

我不知道如何创建 RLIMIT_PRPRIO,我试过

vava             soft    rtprio          10

进入 /etc/security/limits.conf 但这没有帮助。

那么我还应该做些什么来允许自己以实时优先级运行 pulseaudio ?

答案1

确保您已经安装了实时内核:

dpkg -l | grep linux-rt

如果没有列出任何内容,则需要安装一个:

sudo apt-get install linux-rt linux-headers-rt

Ubuntu Studio 默认使用实时内核;我不确定它是否使用与标准 Ubuntu 相同的 apt 存储库。如果您正在运行标准版,但想要 Ubuntu Studio 的一些功能,阅读此页面。关于安装和配置实时内核的部分位于页面的中间位置。另请查看实时支持部分:

获得内核后,您仍然需要为您的应用程序设置实时访问。

您要做的就是授予您的音频组访问 rtprio、nice 和 memlock 限制的权限。为此,您只需运行以下命令,这些命令将向文件 /etc/security/limits.conf 添加一些行:

sudo su -c 'echo @audio - rtprio 99 >> /etc/security/limits.conf'
sudo su -c 'echo @audio - nice -19 >> /etc/security/limits.conf'
sudo su -c 'echo @audio - memlock unlimited >> /etc/security/limits.conf'

相关内容