LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 2516|回复: 14

fedora 11的pulseaudio问题太大,如何解决?(已解决,见后面回帖)

[复制链接]
发表于 2009-8-12 09:25:55 | 显示全部楼层 |阅读模式
fedora 11自带的pulseaudio好像有bug,在播放音乐或者看电影时(无论是用什么媒体工具),时间稍微长一点,就会发现系统反应有点慢,一查发现是pulseaudio进程占用大量cpu资源,声音也中断了。最后不得以只能卸载掉pulseaudio,只剩下alsa底层驱动,发现也可以支持多音频流(我的是笔记本,集成声卡),但gnome的事件音效自然就没有了,而且gstreamer无法发声,凡是基于gstreamer的程序也都无法发生了,gstreamer好像只能用pulseaudio做声音输出后端,请问有何解决办法?本想可能是目前pulseaudio的版本存在这个bug,自己编译pulseaudio的最新开发版应该能解决问题,但从pulseaudio官方网站发现fedora 11自带的pulseaudio已经最新的稳定版了,开发版源码通过git工具下载,但在执行autogen.sh脚本的时候除错:
configure.ac:83: error: possibly undefined macro: AM_SILENT_RULES
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
不知道该怎么解决pulseaudio的问题?记得fedora 10的时候pulseaudio还没有这个问题的,烦人啊:yun:
 楼主| 发表于 2009-8-12 11:04:06 | 显示全部楼层
还是想办法重新编译安装了pulseaudio最新开发版0.9.16-test3,但问题依旧,难道是所谓的pulseaudio从0.9.15(fedora 11自带版本)开始进行了结构重新设计?真实想不通,再下载个早一点的版本0.9.14编译试试看。
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-8-12 16:25:38 | 显示全部楼层
从pulseaudio官方网站下载来最新稳定版0.9.15,编译安装后基本上ok了,没有再出现类似问题。
回复 支持 反对

使用道具 举报

发表于 2009-8-12 18:35:04 | 显示全部楼层
Post by dolphin2000;2015392
从pulseaudio官方网站下载来最新稳定版0.9.15,编译安装后基本上ok了,没有再出现类似问题。
如何编译?似乎卸载不掉pulseaudio(依赖者太多),直接覆盖吗?我如下编译: ./configure --prefix=/usr, 结果提示缺少gdbm.h。我这下没打算解决这个,我有些迟疑,不知这样操作的安全性和正确性如何。既然你弄好了,想请教下具体操作。谢谢楼主了。
回复 支持 反对

使用道具 举报

发表于 2009-8-12 20:25:15 | 显示全部楼层
试试用 spec文件里面的编译参数来编译看看
回复 支持 反对

使用道具 举报

 楼主| 发表于 2009-8-13 09:01:37 | 显示全部楼层
从官方下载pulseaudio-0.9.15最新稳定版压缩包,然后解压缩。对于系统自带的pulseaudio软件包,由于和很多其他的软件包都有关联依赖,如果用yum卸载可能会将很多其他软件包都关联卸载,所以可以保留自带的pulseaudio不删,然后编译新的pulseaudio源代码安装覆盖。当然,你也可以删除自带的pulseaudio,这样更保险一点。如何保证只删除自带的pulseaudio的软件包,而不删处其他呢?可以先安装一个yum的插件,叫yum-plugin-remove-with-leaves,这个插件的作用是尽可能只删除最相关的某个软件及其附属关联包,如下:

yum install yum-plugin-remove-with-leaves

然后,执行命令:

yum --remove-leaves remove pulseaudio

这样就只会删除和pulseaudio直接相关的6个带有pulseaudio字样的软件包了,当然,alsa-plugins-pulseaudio这个包也会删除,但在后面我们编译安装完新的pulseaudio源代码后,还要再从网上找到它并安装之。之后,我们就可以开始编译pulseaudio了。首先要先用yum更新以下automake工具,否则可能会出错吧。命令是:

yum update automake

然后进入pulseaudio源代码目录可以执行:

./configure --prefix=/ --enable-udev=yes

在配置过程中,如果你系统中缺乏一些开发包的话,可能会出错,你可以根据它的出错提示用yum安装所需的开发包。比如上面有人说提示少了gdbm.h这个文件,你要检查一下你系统有没有安装gdbm软件包,如果没有,就用yum install gdbm gdbm-devel来安装所需的包。这里建议--prefix=/,而不是/usr,因为自带的pulseaudio也是安装在/下面的。如果配置无误,那么可以进行编译安装了:

make
sudo make install

编译安装完毕后,进入/etc/pulse目录,这里会有4个自动安装好的配置文件,修改daemon.conf文件,在最末尾增加以下几行:

high-priority = yes
nice-level = -11
realtime-scheduling = yes
realtime-priority = 5
default-fragments = 8
default-fragment-size-msec = 10

保存退出。然后修改default.pa文件,找到load-module module-hal-detect这一行,改为:

load-module module-hal-detect tsched=0

然后保存退出。另外,你需要检查一下,系统是否已经存在一个叫pulse-rt的组了,这个组应该是编译安装时自动生成的,用于执行pulseaudio进程并进行相关设置,你要把你当前的登录帐号加入到pulse-rt组中,可以通过系统菜单->管理->用户和组群的图形化界面来进行组加入操作。之后,你要从网上下载alsa-plugins-pulseaudio和udev-extras两个软件包,可以从fedoraproject.org提供的镜像站点中直接下载,不要用yum来安装,因为安装它们会附带自动安装依赖的pulseaudio包,这会覆盖我们自己编译安装的版本。

完成了上面的所有工作后,重启系统即可。pulseaudio变得乖乖地,真不错。其实就pulseaudio的设计及功能来说确实是非常超前和强大的,在解决了以上问题后,pulseaudio变得非常稳定,并且可以让包括java在内的诸多软件程序都能和谐共享声音设备,让linux的多媒体功能变得更加完备。
回复 支持 反对

使用道具 举报

发表于 2009-8-16 07:48:16 | 显示全部楼层
效果非常好   fedora 10 我开了几个播放器都没事

只是参照修改若干参数  没有修改用户组
很爽



一、修改了 /etc/pulse/daemon.conf 文件
# This file is part of PulseAudio.
#
# PulseAudio is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# PulseAudio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PulseAudio; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA.

## Configuration file for the PulseAudio daemon. See pulse-daemon.conf(5) for
## more information. Default values a commented out.  Use either ; or # for
## commenting.

; daemonize = no
; fail = yes
; disallow-module-loading = no
; disallow-exit = no
; use-pid-file = yes
; system-instance = no
; disable-shm = no
; shm-size-bytes = 0 # setting this 0 will use the system-default, usually 64 MiB

; high-priority = yes
; nice-level = -11

; realtime-scheduling = yes
; realtime-priority = 5

; exit-idle-time = 20
; module-idle-time = 20
; scache-idle-time = 20

; dl-search-path = (depends on architecture)

; load-default-script-file = yes
; default-script-file =

; log-target = auto
; log-level = notice

; resample-method = speex-float-3
; disable-remixing = no
; disable-lfe-remixing = yes

; no-cpu-limit = no

; rlimit-fsize = -1
; rlimit-data = -1
; rlimit-stack = -1
; rlimit-core = -1
; rlimit-as = -1
; rlimit-rss = -1
; rlimit-nproc = -1
; rlimit-nofile = 256
; rlimit-memlock = -1
; rlimit-locks = -1
; rlimit-sigpending = -1
; rlimit-msgqueue = -1
; rlimit-nice = 31
; rlimit-rtprio = 9
; rlimit-rtttime = 1000000

; default-sample-format = s16le
; default-sample-rate = 44100
; default-sample-channels = 2

; default-fragments = 8
; default-fragment-size-msec = 10

二、修改了 default.pa 文件


[root@localhost csbbb]# cat /etc/pulse/default.pa
#!/usr/bin/pulseaudio -nF
#
# This file is part of PulseAudio.
#
# PulseAudio is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# PulseAudio is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with PulseAudio; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.

# This startup script is used only if PulseAudio is started per-user
# (i.e. not in system mode)

.nofail

### Load something into the sample cache
#load-sample-lazy x11-bell /usr/share/sounds/gtk-events/activate.wav
#load-sample-lazy pulse-hotplug /usr/share/sounds/startup3.wav
#load-sample-lazy pulse-coldplug /usr/share/sounds/startup3.wav
#load-sample-lazy pulse-access /usr/share/sounds/generic.wav

.fail

### Automatically restore the volume of streams and devices
load-module module-device-restore
load-module module-stream-restore

### Load audio drivers statically (it's probably better to not load
### these drivers manually, but instead use module-hal-detect --
### see below -- for doing this automatically)
#load-module module-alsa-sink
#load-module module-alsa-source device=hw:1,0
#load-module module-oss device="/dev/dsp" sink_name=output source_name=input
#load-module module-oss-mmap device="/dev/dsp" sink_name=output source_name=input
#load-module module-null-sink
#load-module module-pipe-sink

### Automatically load driver modules depending on the hardware available
.ifexists module-hal-detect.so
load-module module-hal-detect tsched=0
.else
### Alternatively use the static hardware detection module (for systems that
### lack HAL support)
load-module module-detect
.endif

### Automatically load driver modules for Bluetooth hardware
#.ifexists module-bluetooth-discover.so
#load-module module-bluetooth-discover
#.endif

### Load several protocols
.ifexists module-esound-protocol-unix.so
load-module module-esound-protocol-unix
.endif
load-module module-native-protocol-unix

### Network access (may be configured with paprefs, so leave this commented
### here if you plan to use paprefs)
#load-module module-esound-protocol-tcp
#load-module module-native-protocol-tcp
#load-module module-zeroconf-publish

### Load the RTP reciever module (also configured via paprefs, see above)
#load-module module-rtp-recv

### Load the RTP sender module (also configured via paprefs, see above)
#load-module module-null-sink sink_name=rtp format=s16be channels=2 rate=44100 description="RTP Multicast Sink"
#load-module module-rtp-send source=rtp.monitor

### Automatically restore the default sink/source when changed by the user during runtime
load-module module-default-device-restore

### Automatically move streams to the default sink if the sink they are
### connected to dies, similar for sources
load-module module-rescue-streams

### Make sure we always have a sink around, even if it is a null sink.
load-module module-always-sink

### Automatically suspend sinks/sources that become idle for too long
load-module module-suspend-on-idle

### If autoexit on idle is enabled we want to make sure we only quit
### when no local session needs us anymore.
load-module module-console-kit

### Enable positioned event sounds
load-module module-position-event-sounds

### Load additional modules from GConf settings. This can be configured with the paprefs tool.
### Please keep in mind that the modules configured by paprefs might conflict with manually
### loaded modules.
.ifexists module-gconf.so
.nofail
load-module module-gconf
.fail
.endif

# X11 modules should not be started from default.pa so that one daemon
# can be shared by multiple sessions.

### Load X11 bell module
#load-module module-x11-bell sample=bell-windowing-system

### Register ourselves in the X11 session manager
#load-module module-x11-xsmp

### Publish connection data in the X11 root window
#.ifexists module-x11-publish.so
#.nofail
#load-module module-x11-publish
#.fail
#.endif

### Make some devices default
#set-default-sink output
#set-default-source input

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?注册

x
回复 支持 反对

使用道具 举报

发表于 2009-8-16 12:43:53 | 显示全部楼层
我装系统完了第一部就是把pulse这个垃圾卸载掉,
很垃圾的一个东东,cpu站用率奇高无比
回复 支持 反对

使用道具 举报

发表于 2009-8-17 21:57:47 | 显示全部楼层
我也遇到这问题,但好像只要
修改default.pa文件,找到load-module module-hal-detect这一行,改为:

load-module module-hal-detect tsched=0
就行了

可以看下这里 https://fedoraproject.org/wiki/F ... io#Contingency_Plan
回复 支持 反对

使用道具 举报

发表于 2009-8-18 11:49:53 | 显示全部楼层
I got the solution from http://www.brent2006.name/showpost.asp?post_id=0000000065
备份 /etc/asound.conf 文件,并建立新的 /etc/asound.conf 文件如下:
## This is accessed by oss applications
pcm.dsp0 {
type plug
slave.pcm "dmixer"
}
## This ties mixer controls for oss mixer programs
ctl.mixer0 {
type hw
card 0
}
## This is a softward driven mixer, alsa's 'dmix'
pcm.dmixer {
type dmix
## this can be any unique value
ipc_key 1024
slave {
## pointing to your card
pcm "hw:0,0"
period_time 0
## These options are tweakable
period_size 1024
## but use powers of 2 for sizes
buffer_size 4096
## the sample rate
rate 48000
periods 518
}
## this binds channel 'n's input to channel 'n' output
bindings {
0 0
1 1
}
}
## The default sound driver, a wrapper for dmixer
pcm.!default {
type plug
slave.pcm "dmixer"
}
编辑 /etc/pulse/default.pa 文件
找到下面一行
#load-module module-alsa-sink
改为
load-module module-alsa-sink device=dmixer
找到下面一行
load-module module-suspend-on-idle
改为
#load-module module-suspend-on-idle
找到下面一行
load-module module-hal-detect
改为
#load-module module-hal-detect

重新启动即可见效。
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表