Over-optimistic buffering in PulseAudio causes underruns (audible stuttering, pops)

Bug #190754 reported by kripken
210
This bug affects 8 people
Affects Status Importance Assigned to Milestone
gst-plugins-good
Fix Released
Medium
paconfig
Invalid
Undecided
Unassigned
linux (Ubuntu)
Fix Released
Undecided
Unassigned
Declined for Hardy by Daniel T Chen
pulseaudio (Mandriva)
Fix Released
Medium
pulseaudio (Ubuntu)
Fix Released
Low
Unassigned
Declined for Hardy by Daniel T Chen

Bug Description

Responsiveness of the desktop in Hardy, under CPU load, is significantly poorer than in previous versions of Ubuntu, on the same hardware.

The easiest way to see it for me is to do this:

1. Downclock my Athlon64 3000 to 1Ghz from 2; this makes things more noticeable. I also suspect that people running fast machines is why this isn't reported more. Perhaps especially on multicore machines it won't be significant.
2. Record a long-enough piece in Sound Recorder (doesn't matter what, so long as you would notice if it didn't play smoothly).
3. Press play, and do Alt-Tab between the Sound Recorder window and e.g. Firefox, Nautilus, Totem, etc.

The symptom is that sound 'stutters' along with what sounds like static interference. If the sound recording is music, then it becomes impossible to listen to in a pleasant manner.

Similar and worse symptoms occur when doing so under CPU load, say when compiling a big app, applying updates, etc.

This is not a hardware issue, since the same computer was very responsive under Gutsy (and older versions), even at 1GHz. However, I state my specs here just for comparison: Athlon64 3000, 512MB RAM, AC'97 onboard sound,

00:11.5 Multimedia audio controller: VIA Technologies, Inc. VT8233/A/8235/8237 AC97 Audio Controller (rev 60)

and using the NVidia binary driver for video.

My (unfounded, hence I didn't specify a package for this bug) suspicions are that perhaps the issue is to do with the new CPU scheduler (CFS) and/or the new sound backend (Pulseaudio). I suspect them only because they are new, I have no specific evidence against either at this point.

Revision history for this message
Murat Gunes (mgunes) wrote :

Thanks for reporting. Do these interruptions/stutters only occur with audio, or do other apps stutter as well when there are no audio operations but the system is under heavy load?

Revision history for this message
kripken (kripkenstein) wrote :

This occurs with other things than audio, but is much harder to notice. For example, when playing a movie in Totem during heavy CPU load (compiling something in another window), I see both audio and video stuttering. But the video is much harder to notice, you need to look carefully to see that it isn't smooth. Whereas the audio stuttering and 'static' can't be ignored.

Revision history for this message
Gaspard Leon (gaspard.leon) wrote :

Confirming using:
Athlon XP 2500+ 1.83Ghz
ABit NF7-S Mobo w/ NForce 2 chipset
2GB RAM
NVidia 5900XT w 128MB with 169.09 from the restricted package
SCSI, SATA, and IDE harddrives

- Open Rhythmbox
- Choose Import folder from the menu
- Choose my music folder, which was about 4000 files, 20GB..
- CPU pegs at 100%, so should be a good test.
- while it's importing to the library, try to play a movie file...
strangely, the sound of the movie is solid, but the video is stuttery for me

While typing in this firefox window to confirm the bug (library still importing), there is significant lag while typing the text...
If you hold down a key like left or right to scroll through the text it's jumpy.

will have to reboot into Gutsy to confirm it's hardy-only...

Cheers,
Gaspard

Revision history for this message
Gaspard Leon (gaspard.leon) wrote :

confirming, I just rebooted to gutsy, (with hardy kernel 2.6.24-7)

dumped my media library in ryhthmbox to confirm using the same procedure.

with CPU pegged at 100% the system is smooth and responsive, video and audio play smooth without hitching...

typing the text into this box is normal.

Maybe it has something to do with the new GVFS?? seeing as I'm using the same kernel on Gutsy and Hardy, the big difference is that GNOME and the apps are newer

Cheers,
Gaspard

Revision history for this message
Wade Menard (wade-ezri) wrote :

It sounds like you are experiencing the symptoms of bug 131094

Revision history for this message
kripken (kripkenstein) wrote :

> It sounds like you are experiencing the symptoms of bug 131094

No, I believe that is an unrelated manner. I experience this bug even without any disk IO, as shown in my example above, of alt-tabbing between Sound Recorder and Firefox. There is little if any disk IO in such a case as far as I can tell.

Also the older bug is relevant to various Ubuntu releases, and this new bug appears to happen *only* in Hardy, i.e., it is very new.

Revision history for this message
Kim Krecht (kim.krecht) wrote :

I am confirming the occurence of this problem with current hardy on a IBM ThinkPad T30, 2366-97x. It only shows when using PulseAudio as output as opposed to ALSA. I am deviating from the default PulseAudio configuration only in this way:

--- /tmp/default.pa 2008-02-25 21:41:01.000000000 +0100
+++ /etc/pulse/default.pa 2008-02-25 17:34:25.000000000 +0100
@@ -37,0 +38,4 @@
+#### Kim~* {
+load-module module-alsa-sink device=default
+load-module module-alsa-source device=default
+#### }
@@ -41 +45,2 @@
-load-module module-hal-detect
+#### Kim~*
+#load-module module-hal-detect
@@ -45 +50,2 @@
-load-module module-detect
+#### Kim~*
+#load-module module-detect

This is just to make Skype work with the "raw" ALSA device instead of PulseAudio's emulation; Skype would not work otherwise.

I believe that overly optimistic buffering on PulseAudio's side is to blame here. The buffer is extremely small (on the order of a few dozen milliseconds or so) and thus underruns whenever failed to be fed continuously. Alt-Tab hogs resources for a long enough time to make this happen even without any IOWAIT or significant load. Seeing that my machine neither supports APIC properly nor has a second core, it is plausible that interrupts can unfairly steal CPU time even with a current kernel and its Completely Fair Scheduler. (With just the XT-PIC, any PCI interrupt will cause the system to ask every device on the PCI bus whether it caused the interrupt; also, with just one core, interrupts cannot be handled elsewhere, which might enable PulseAudio to run smoothly.)

Another source of disruption besides Alt-Tab is apt-get update. It will stutter about once for every package list file processed. Who knows, even fork() and/or the associated switches between kernelspace and userspace might be the culprit.

I have not had a look at the PulseAudio source since I would not know where to start.

PulseAudio seems to adapt its behaviour once a sufficient number of Alt-Tabs has been performed. Stuttering does not occur then anymore. It seems that more data is then buffered than under normal conditions. This looks akin to something like TCP slow-start in reverse ;)

Also, having sufficiently advanced hardware (my machine is in its sixth year) would obviously hide all of this.

The correct fix, IMHO, would be to make tweaks to the thresholds, constants, coefficients involved in the buffer size calculation, making it more conservative than it is now. However, I do not know how many buffers exist and where they are. There could be a per-sink buffer, a buffer for the netlink, a buffer in the core. Again, I would not know where to look.

It might also help to use a kernel patched for LatencyTOP and LatencyTOP itself to see whether any kind of priority inversion occurs.

Sorry for being unable to provide patches.

Murat: Simply being under load does not significantly impact responsiveness for me. Load averages of about 10 while playing back MPEG-4 Part 2 ASP video (such as Xvid encoded files) are free of problems - no frames dropped at all.

Revision history for this message
rubinstein (rubinstein) wrote :

I also have stutter when listening to audio under Hardy Heron.

I always set my Windows Preferences to "Select windows when the mouse moves over them". So now I only have to move my mouse to different applications, and sound begins to stutter. As pulseaudio has different settings for each application, maybe this could be a thing to consider, maybe something is broken here.

If I move the mouse very quickly over different windows, Xorg will have a high load (with and without the proprietary nvidia driver.).

Revision history for this message
rubinstein (rubinstein) wrote :

Also, it appears that the music will play ca. 20% slower when it stutters, and after some time it is normal again. I can make a sound recording and attach it to this bug, it it helps.

Revision history for this message
TerryG (tgalati4) wrote :

Marking as Confirmed, since enough people seem to notice this problem. I haven't seen any reference to an interaction between tickless kernel and pulse audio. Does the real time (rt) kernel suffer the same problem?

Changed in pulseaudio:
status: Incomplete → Confirmed
Revision history for this message
Colin Ian King (colin-king) wrote :

It may be worth seeing where the latencies are occurring using LatencyTop: http://www.latencytop.org

Revision history for this message
Christian Lachner (gladiac) wrote :

I also experience this problem on a Thinkpad T61 which is a dualcore machine with 4GB of RAM meaning you can even face this problem on decent hardware. I mostly notice this "stutter"-behaviour when hearing mp3s using audacious with the pulseaudio soundserver. It also happens even on low cpu-load. Using ALSA directly works fine for me.

Revision history for this message
psernetz (patrick-sernetz-com) wrote :

Do you guys updated to hardy with apt-get dist-upgrade or the update manager or did you a clean install from cd. I've experienced this problem with my update-manager updated version of hardy. Hearing mp3 with rhythmbox and minimizing windows caused a stuttering sound. Now I've did a complete reinstall from the alpha 6 cd and now everything is running smooth again.

Revision history for this message
rubinstein (rubinstein) wrote :

I did a fresh install with alpha 6 - sound is better, but nonetheless a bit stuttering when changing/minimizing windows.

Revision history for this message
kripken (kripkenstein) wrote :

I experience this bug (both sound and video) on a fresh install of Hardy (from around 2 months ago).

Revision history for this message
Gaspard Leon (gaspard.leon) wrote :

I installed on a separate partition, from Alpha 3, upgraded to the date I posted the message above (Feb 19th)

I have yet to redo the tests with the latest round of updates, but my hardy was not an upgrade from gutsy, my gutsy install is still gutsy

Revision history for this message
psernetz (patrick-sernetz-com) wrote : Re: [Bug 190754] Re: Bad multitasking / responsiveness in Hardy

It would be good if someone else could do a complete reinstall of alpha6
and check if the problems then still exists. My lag problems are all
gone.

CPU AMD k6/2 2000
512 MB ram
Gefroce 6200 graphicscard

Revision history for this message
Bruce R (bm007a0030) wrote : Re: Bad multitasking / responsiveness in Hardy

After a re-install of Hardy Alpha-6 so as to get today's revised kernel 2.6.24-12-generic on my E2160 rig, I installed Exaile, Kaffeine and VLC Player, plus the usual Gstreamer plugins etc, all as per Gutsy.
Although Hardy appears to be slightly faster than Gutsy, I find that running more than one audio-visual package results in audio conflict or even crashing of Kaffeine, if already running.

On the same rig, Gutsy allows me to set FreeView Kaffeine running, with audio carried across to a desktop on which I can run other packages, like Firefox etc, but Hardy doesn't like such multi-tasking.

Revision history for this message
Bruce R (bm007a0030) wrote :

Further Information - My E2160 rig uses Envy Legacy 6 for Gutsy, EnvyNG9 for Hardy-Alpha5

Revision history for this message
Arthur Cruz (s3t-sk8) wrote :

Fresh install of Alpha 6, then updated.
Well, sound lags.. and it's pretty annoying since it lags every "libnotify notification" from my IM client.

Have anybody tried another distro with pulse audio and 2.6.24 kernel?

Revision history for this message
Bruce R (bm007a0030) wrote : Re: [Bug 190754] Re: Bad multitasking / responsiveness in Hardy

I think that you will find that in using kernel 2.6.24 to make Ubuntu
easier to install, on a wider range of hardware than Gutsy which
used kernel 2.6.22, the team are at 'the cutting edge' of kernel use.
At kernel.org there are signs of work on kernel 2.6.25, but I know
of no distro actually using it yet.
Fingers crossed, the definitive Hardy kernel will further the great
work started by Gutsy and its sibling Daryna (Mint4).

Revision history for this message
Shane (duairc) wrote : Re: Bad multitasking / responsiveness in Hardy

Probably of no use to anybody, but this happens to me when playing in Quod Libet and alt-tabbing, etc.

I'm have an Athlon64 3000+ (1.8GHz), 1GB of RAM and an Nvidia 6800 GS (512MB).

While I don't know what graphics cards the laptops mentioned here have, it seems to me that everyone that has listed a graphics card seems to have an Nvidia card? Could this somehow be a problem with Nvidia's proprietary graphics drivers? (which of course would make it very difficult for Ubuntu to fix)

Revision history for this message
Arthur Cruz (s3t-sk8) wrote :

Wow, I have just updated Hardy, which updated Alsa as well!
I'm not experiencing this lags anymore! Alt+Tabs are okay, notifications don't lag anymore.. it's great!

After several tests here I conclude that this problem is gone in my AMD Athlon 2200+, VIA mother board, Nvidia video card and Sis sound.

Revision history for this message
Arthur Cruz (s3t-sk8) wrote :

oh.. premature conclusion!

It's not solved, but less noticeable.
The lags are still here. Not so frequently.

Revision history for this message
Bruce R (bm007a0030) wrote : Re: [Bug 190754] Re: Bad multitasking / responsiveness in Hardy

Regarding 'Shane' comment, the preponderance of NVidia cards is
probably because even Alberto Milone's Envy hasn't yet made new
ATI cards work properly, whilst Envy also confers a great desktop
versus overlay control panel to NVidia clones, complete with a GPU
temperature monitor !

Revision history for this message
Shane (duairc) wrote : Re: Bad multitasking / responsiveness in Hardy

I also just noticed that this bug doesn't seem to affect sound playing in Flash (for example, playing a song from a YouTube video or something). Is this significant or is this to be expected?

Revision history for this message
fuoco (fuoco2-deactivatedaccount) wrote :

Shane: It certainly is, but probably makes sense to know which flash plugin you use. I know for certain gnash goes through pulseaudio if it's available - and if not probably just alsa. Don't know about the adobe flash plugin.

What is not clear to me still from this bug is whether this issue is a sound specific problem (lag and so on) - and then this is either pulse or alsa problem. Or whether this is a general responsiveness and multi tasking problem - and then most chances the kernel is to blame... (or some new configuration policy)
I personally suffer mostly from general unresponsiveness and slowness - sometimes the sound indeed halts when I just switch to another window (alt-tab, or just click-to-focus). And sometimes it's much more annoying - for example during a system update, refresh package list or install of packages the whole system is hardly responsive, slows down any interactive app, like firefox or a terminal and so on. This issue is very annoying - and certainly not related to sound.
So in the end is this bug about this problem, and just uses sound as a manifestation of it? or is it just a sound specific bug?

Revision history for this message
Shane (duairc) wrote :

I'm using the Adobe plugin... I don't know what it uses, but there's something in the back of my head telling me it's ALSA. Personally I haven't noticed any significant problems with multitasking so far with Hardy, though I've only been using it for a few days. Sound is definitely the biggest manifestation of this problem for me, if it is a general problem.

Revision history for this message
ubunturox (ubunturox-kk) wrote :

I had problems till yesterday - very disturbing lag, crackling etc. Today it seems to have disappeared. hardy x86 latest updates on Asus Z92 M laptop Turion dual core.

Revision history for this message
ubunturox (ubunturox-kk) wrote :

I spoke too soon. The disturbance comes back once I change volume level. I have to restart the player to get rid of the disturbance.

Revision history for this message
-JojoMan- (jojoman02) wrote :

i experience the same problem, i think it's a pulseaudio thing, this is really bad for laptops b/c they have less cpu power than desktops and most of my friends own only laptops.

Revision history for this message
-JojoMan- (jojoman02) wrote :

When i set the mixer & ALL sound playback to ALSA the problem *completely* goes away, so is DEF a pulseaudio problem.

Other users please Confirm that this fixes the issue.

Revision history for this message
Christian Lachner (gladiac) wrote :

Yes, I can confirm what JojoMan says. First, I thought it could be an internal buffering problem in the pulseaudio-server itselfs but that would not explain why the whole machine gets stuttering... I think the sound stuttering is just a side-effect and the real problem lies somewhere else... in connection with PA...

Revision history for this message
Arthur Cruz (s3t-sk8) wrote :

I can confirm what JojoMan says too. I've been using only ALSA and there are no lagging issues anymore.

Revision history for this message
Najmudin (hussain-hammady-gmail) wrote :

I don't think this to do with hardy only , i experienced this problem with my brand new desktop before 3 months back when i tried to install Ubuntu gutsy 7.10 on it , the spec where : intel(R) Core(TM)2 Duo CPU E4500 @ 2.20GHz - 2 GB of memory , i tried the alternate installation also and get the same problem , finally i managed to get rid of it by installing Ubuntu Studio 7.10 which has a different kernel ( 2.6.22-14-rt ) the problem gone and every thing was fine , yesterday i installed hardy heron beta and I'm now having the same stutter in sound even if I'm not moving the mouse cursor or opening any application , tried to stop using compiz and close many applications but still the same.
I tried to change all devices to alsa , but still getting the same stutter
Another thing i noticed but not sure if its related to this bug , when i was using Ubuntu studio 7.10 i was not able to do a memory test from
grub screen i was getting this error : Error 28 : selected item cannot fit into memory
and now i cant do it also.
I feel that something is wrong with the kernel itself. ( just my feeling )

Revision history for this message
Rotbart van Dainig (rotbart-van-dainig) wrote :

Gutsy had Jitter with O1 and ALSA when there was heavy load, like crypto disk R/W.
That problem is gone with Hardy - CFS really manages to keep sound stable in such sitations.

The interesting thing is that it only happens when minimizing/raising windows (especially from the notification area, no matter using Metacity or Compiz) - not when, say, looping the cover-flow task switcher plugin of Compiz.

Revision history for this message
Najmudin (hussain-hammady-gmail) wrote :

I did a new hardy installation using the alternate CD beta , then set all the sounds setting to ALSA , the result is no stutter when I'm idle or minimize or maximize window , the stutter appear when starting any application for example it happend when trying to start Open Office Word processor or opening System Monitor window , it happens when opening them for the first time in an ubuntu session but closing and reopening again can't feel any stutter.

Revision history for this message
Helge Willum Thingvad (helgesdk) wrote :

I have the same problem, but it does no occur when streaming to a remote PulseAudio sink over the network (the receiving machine is running Gutsy).
Also, I have so far only experienced the problem in MPlayer, not VLC nor Firefox.
I can get MPlayer to work with OSS (and pasuspender) without stutter.

Can we conclude this is a problem somewhere between the pulseaudio daemon and alsa?

Changed in pulseaudio:
importance: Undecided → Medium
Revision history for this message
J0Sb31R (josbeir) wrote :

Also having this problem...
example: playing music in rhythmbox when the song starts... doing a few window switches/alt-tabs etc... after a while the stuttering goes away...
It's really irritating because it happens every time.. also with movies etc...

Only way to resolve this is to set playback to ALSA in sound config. But i don't want to do that.
--
Gefore 8600GT
Amd64 3500+
Nforce4 motherboard => Nvidia CK804/Realtek ALC850 rev0
--

Revision history for this message
Helge Willum Thingvad (helgesdk) wrote :

After deleting configuration files and reinstalling PulseAudio, it somehow fixed itself.
I no longer have problems with stuttering, but am continuing to experience a very long audio delay in VLC (bug 3735).

Daniel T Chen (crimsun)
Changed in pulseaudio:
status: Confirmed → Invalid
Changed in pulseaudio:
status: Invalid → Confirmed
Changed in paconfig:
status: Unknown → New
Daniel T Chen (crimsun)
Changed in linux:
status: New → Fix Committed
Changed in pulseaudio:
status: Confirmed → Incomplete
87 comments hidden view all 167 comments
Revision history for this message
huiii (a00ps) wrote :

i have done that, updated this morning to the proposed repo, 60 updates altogether plus 2.6.24-17-rt.
overall performance got better, had suddenly old bug known from gutsy wuth switching to virtual console (blanck), solved like in gutsy by adding vesafb, but all in all it runs smoother.
I GOT still the problems as explained before and i think we got prolems with Xorg.
look to your CPU-usage of Xorg when listening to music and browsing the net.
it goes up like uhuh just by switching tabs and still lets my sound breaks / stops / for a sec.
no guys, this issue is NOT SOLVED with new kernel.
but thx anyway.
:)

Revision history for this message
Gaspard Leon (gaspard.leon) wrote :

Well, I've finally upgraded to the release version of Hardy (blew away my beta version)
with freshly installed hardy (+ updates) it seemed fairly reasonable, wasn't seeing too many slowdowns... until I started using it a bit more..

So I upgraded to the proposed 2.6.24.17.19 kernel... much improved responsiveness!! firefox seems to scroll properly now =)
but pidgins little notification sounds were still popping?!!

So I followed psyke83's directions in the thread http://ubuntuforums.org/showthread.php?p=4928900
(except the equalizer part, I added all the fixes there, updated libasound, added /etc/asound.conf file, added buffer changes to /etc/pulse/daemon.conf)

Now the pidgin sounds are fine and I'm testing rhythmbox as I type this, and have been satisfied... there are no pops even using flash and multi-tab firefox.

Revision history for this message
huiii (a00ps) wrote :

thx to gaspard leon for the link,
it is getting much much better after following step C.
(64bit)

Revision history for this message
Luke Yelavich (themuso) wrote : Re: [Bug 190754] Re: Over-optimistic buffering in PulseAudio causes underruns (audible stuttering, pops)

Can everybody please try the version of pulseaudio in my ppa, linked to below? I've changed the fragment size settings, and have found particularly for stuff using the pulse alsa-plugin, that performance has been improved. Please report back with feedback:

deb http://ppa.launchpad.net/themuso/ubuntu hardy main

Thanks.

Revision history for this message
huiii (a00ps) wrote :

hello,
i followed by now more or less the suggestions / links mentioned in this thread:
things got better in general. latest updates seem to fix some related stuff too.
adding the deb http://ppa.launchpad.net/themuso/ubuntu hardy main
to the repo list did update the pulseaudio stuff. nevertheless I am still experiencing some symptoms discribed above:
when listening to rhythmbox while browsing the net with firefox, switching fro tab to tab can cause interrupts in playback.
anyone experiencing this?

Revision history for this message
Tim Skinner (timskinner1) wrote :

I am still experiencing this bug when running updates (maybe update manager is cpu hungry)

Revision history for this message
Richard Mayhew (richard-bouncingfox) wrote :

After the updates I still experience stutters when new packages are being installed whether that be from synaptic, update manager or command line. I don't get any noticeable stutters with any other high CPU usage except for the situation mentioned above of course.

Revision history for this message
Max Randor (max-randor) wrote :

@ Richard Mayhew

That is most likely because update-manager etc a lot of RAM (not all at once but they have a high change in ram/s)
Or at least my RAM usage graph wiggles a lot more when update-manager/ apt-get is running so I assume this is the case.

High CPU usage + high RAM usage = stuttering - at least for me.

Try running some programs that take CPU usage up to 100% and then start firefox and open office at the same time.

Revision history for this message
Michele Costantino Soccio (michelinux) wrote : [Bug 190754] Kernel 2.6.24-18 fixed the problem

Just update my Hardy and got the 2.6.24-18 kernel: it fixed the problem
and even under heavy stress (transmission, azureus (java), evolution,
firefox, amarok, synaptic) no shuttering occurs in _any circumstance_. I
got the new kernel from the hardy-updates repository.

Great!

Revision history for this message
Richard Mayhew (richard-bouncingfox) wrote :

OK i have tried to re-create the stutter with using apt-get under high CPU stress and RAM load but not managed it yet. I guess when i did get it there were some particular updates that caused the stutter. Looks like it is fixed, thanks guys.

Revision history for this message
joshlukas (joshlukas) wrote :

Not fixed for me. :( I thought the same as I updated to the new 2.6.24-18 kernel. For about four, or five hours no shuttering, and then it just occured again and cant't be fixed till next reboot. :( Have tried to build my own kernel 2.6.25-4 with and without rt patch. Tried to set it to server kernel for high latency. It just won't stop music beeing skipped while I'm interacting with my computer in any way. It occures even if typing a text in some forums, texteditor, so the system is idle. :(( I tried to make some modifications to pulse as follows: http://aryuna.de/spdif_mit_ubuntu_hardy_und_audiophile_2496

Revision history for this message
Josh Green (josh-resonance) wrote :

I just upgraded to 2.6.24-18 kernel as well. At first I was using the rt kernel, which did not behave any better in regards to audio drop outs (than previous versions in Hardy). Of note is that I'm NOT using PulseAudio, but just plain ALSA. I then tried the regular 2.6.24-18 kernel and I have yet to been able to get Rhythmbox to drop out. Using a small test application I wrote which does system calls like malloc() and chdir() and times how long they take, I found that running this app as a normal user with the rt kernel can spike up over 400ms for system calls when doing things like minimizing/maximizing windows, whereas the generic 2.6.24-18 kernel max is under 80ms. I believe the default gstreamer buffer size is 300ms. So there still exist some differences between the rt and non-rt 2.6.24-18 Ubuntu kernel which are causing rather significant system call latencies. Of note though, is that SCHED_FIFO audio applications are able to run on my system with the rt kernel at sub 4ms latency, without issues, so the problem is for the SCHED_OTHER normal user case. I was previously using the rt kernel in Gutsy without these issues, so there is likely still something to be fixed in the latest rt kernel.

Revision history for this message
cl (flipper98-deactivatedaccount) wrote :

the .18 kernel update didn't fix the problem for me either. still crackling sound when arriving pidgin or cgmail notifications.

Changed in paconfig:
status: New → Invalid
Revision history for this message
huiii (a00ps) wrote :

might this be related to Xorg? in conjunction with other bugs / "de-optimizations" here and elsewhere?
I find it very demanding, lately..
scrolling firefox, openoffice, thunderbird, skype, switching tabs, minimizing, maximizing, etc.. peaks Xorg to exaggerated CPU-usage... it got better in average, dropouts of sound became rare, but i find it altogether worse than under gutsy on slower laptop.

Revision history for this message
Karl Frisk (karl-frisk) wrote :

not fixed for me as well. pulseaudio has still to be turned off here.

Revision history for this message
Conn O Griofa (psyke83) wrote :

PulseAudio's resample-method in Ubuntu is currently set to "speex-float-3", which uses a high amount of CPU when a client uses a different sample rate than the server.

Here's an example: if you play a 48Khz mp3, it has to be downsampled PulseAudio's default rate of 44.1Khz. On my system, the pulseaudio process takes up a ridiculous amount of CPU in such a case, usually between 15-20% on my Pentium M 1.5Ghz system. On the other hand, playing a 44.1Khz mp3 causes pulseaudio to use around 5-10% CPU on average (as it uses the resample-method "copy", which is no resampling at all).

Unfortunately, PulseAudio cannot change sample rates dynamically (see http://www.pulseaudio.org/ticket/262 ), so we can mitigate this high CPU load by using a faster resampler. I propose that we use the "speex-fixed-0" resample-method, as it reduces pulseaudio's average CPU usage from ~15% to ~10% when resampling.

See Mandriva's bug report here: https://qa.mandriva.com/show_bug.cgi?id=36084
Their resolution to high CPU usage was to change the resample-method to "speex-fixed-0".

Revision history for this message
Conn O Griofa (psyke83) wrote :

Ok, a quick follow-up to my previous post.

I played a movie (Blade III, audio at 48Khz and PulseAudio server at 44.1Khz) as a resampling test and I could hear crackling (that's unrelated to buffering) during explosion sequences. It seems the resampler "speex-fixed-0" causes some crackling distortion only at high volumes. I tried "speex-float-0" and there is no crackling or distortion even at the loudest volume, and CPU usage is still less than "speex-float-3". At the very least I think someone responsible for PulseAudio in Ubuntu and/or with high-end audio equipment should do some experiments with these resamplers, because at the moment PulseAudio is using an excessive amount of CPU.

Revision history for this message
Paul Drain (pd) wrote :

Just tried this myself, on a 2.2Ghz Core 2 Duo laptop, i'm getting 8% CPU using the default settings, with a noticable crackling/static sound at higher volumes (90 or above) -- so after reading this bug, I ran some tests to see if I could stop the pops.

The best result I found was speex-float-1, which caused no crackling on a HDTV .wmv file using the Flumotion binary WMV codec via Totem, at ~3-4% CPU instead, speex-float-0 caused the same file to playback slowly (although, rewinding or fast-forwarding through the movie caused the movie to play normally for around 30 seconds before the slowdown appeared again).

So CPU use was about the same using float-0 and float-1 here, float-1 caused no lag (if that's the right way to describe it) though.

Would it be worth running the same tests using -fixed-X?

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

After upgrading to Hardy some time ago, I found that when doing my regular development work, audio stuttering was all too often the norm (extremely annoying). This seems to happen not only with CPU-intensive tasks, but IO-intensive ones.

I stumbled across this bug this morning, and tried speex-float-0 which almost completely solved my audio issues, with having only 3 skips in 10 minutes (before, I might have that many in 15 seconds). My testing consists of running four concurrent compilations of evolution with 5 kvm virtual hosts doing various activities. This is on a dual core with 2GB of RAM (but 1.25GB taken by virtual machines). This was easily enough to cause audio extensive stuttering before.

I am not sure what the default should be as my use case is atypical, but it is clear that this configuration option should *at least* be more discoverable (maybe in release notes or other documentation).

Revision history for this message
Pacho Ramos (pacho) wrote :

Will this be fixed for hardy 8.04.1 at least? There are some known bugs (with already included fixes or workarounds) related with pulseaudio that are still unfixed

Thanks

Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Marking as confirmed as it is affecting many people and people responded to Luke's request to try his PPA packages.

Changed in pulseaudio:
status: Incomplete → Confirmed
Revision history for this message
Daniel Gimpelevich (daniel-gimpelevich) wrote :

Adding paconfig to the bug was an accident; paconfig is unaffected.

Changed in paconfig:
status: New → Incomplete
Changed in gst-plugins-good:
status: Unknown → New
Changed in pulseaudio:
status: Unknown → Fix Released
Revision history for this message
Hrotkó Gábor (roti-al) wrote :

Hi!

 My pulseaudio stuttering problem solved by adding myself to the pulse-rt group by entering:

sudo usermod -a -G pulse-rt $USER

Afterthat: log out and log in.

My soundcard:

$lspci | grep audio
00:10.1 Audio device: nVidia Corporation MCP51 High Definition Audio (rev a2)

Roti

Revision history for this message
Marco Tacchini (tyrchyus-fastwebnet) wrote :

HI!

i solved my scrachy sound.
Try to set in your daemon configuration file | Resample-methods= trivial |
Now i have simoultaneus output and nothing interruption of sound.
i hope that this help someone..

bye, tyrchyus

Revision history for this message
Daniel T Chen (crimsun) wrote :

Demoting importance due to known workaround. Definitely should be considered for 8.10 alpha 6, as the change is trivial.

Changed in pulseaudio:
importance: Medium → Low
status: Confirmed → Triaged
Revision history for this message
Andrew Starr-Bochicchio (andrewsomething) wrote :

@Daniel

Could you please point to the trivial change that you believe needs to be made. It is not clear at all from the thread. A number of completely different workarounds have been posted. There's a lot to wade through here. If someone could provide a summery, pointing out the proposed change, it would be much more likely that a developer would act on this.

I also notice that you have declined the Hardy task. If the change is trivial, wouldn't it be useful to submit a update to hardy-proposed?

Please note that I personally have not experienced this issue in some time....

Revision history for this message
Tim Skinner (timskinner1) wrote :

I haven't experienced this in Hardy for a while. But when I fresh installed Intrepid beta, this seems to have become an issue again. Has a fix been commited?

Revision history for this message
Pacho Ramos (pacho) wrote :

Mandriva is changing resampling method with this patch since months ago, and work really great (well, in general mandriva pulseaudio implementation works much better than ubuntu one, I am not suggesting that pulse maintainer in ubuntu is bad or something else, I am simply suggesting maintainer to see how mandriva is solving most of opened issues related with pulseaudio for getting them also in ubuntu hardy and intrepid)

You can go to:
ftp://ftp.free.fr/pub/Distributions_Linux/MandrivaLinux/devel/cooker/SRPMS/main/release

and check pulseaudio src.rpm for more info

Thanks

Revision history for this message
Tim Skinner (timskinner1) wrote :

to clarify further, this has become worse for me in Intrepid; it appears not to be fixed and worse still, pulseaudio now seems to crash under high cpu load.

Revision history for this message
Patricio (patricio-stwing) wrote :

Just to confirm, same problem here.
When I scroll in Firefox, the sound gets choppy
Thanks!

Revision history for this message
Patricio (patricio-stwing) wrote :

So... how do I change the sampling method to speex-fixed-0 ??
Thanks!

Revision history for this message
Patricio (patricio-stwing) wrote :

sudo usermod -a -G pulse-rt $USER
seems to work

Revision history for this message
Ludovic Claude (ludovicc) wrote :

@Patricio:
sudo nano /etc/pulse/daemon.conf
enter your password, then change the line with resample-method to
   resample-method = speex-float-0

Revision history for this message
Motin (motin) wrote :

I get this output (repeated a zintillion times) from pulseaudio -vv when making Skype calls:

I: client.c: Created 3562 "Native client (UNIX socket client)"
I: protocol-native.c: Got credentials: uid=1000 gid=1000 success=1
I: protocol-native.c: Enabled SHM for new connection
I: client.c: Client 3562 changed name from "Native client (UNIX socket client)" to "ALSA plug-in [skype.real]"
D: memblock.c: Pool full
D: memblock.c: Pool full
D: memblock.c: Pool full
D: memblock.c: Pool full
D: memblock.c: Pool full
D: memblock.c: Pool full
D: memblock.c: Pool full
D: memblock.c: Pool full
D: memblock.c: Pool full
D: memblock.c: Pool full
D: memblock.c: Pool full
D: memblock.c: Pool full
D: memblock.c: Pool full
D: memblock.c: Pool full
D: memblock.c: Pool full
D: memblock.c: Pool full
D: memblock.c: Pool full
I: client.c: Freed 3562 "ALSA plug-in [skype.real]"
I: protocol-native.c: connection died.

Is this the same bug or a new one?

Revision history for this message
Daniel T Chen (crimsun) wrote :

Motin, a different bug.

Revision history for this message
Matthew Harris (mnharris) wrote :

I added my bug report to this, but I should have pointed out that it started with my upgrade to jaunty. It seems to be very close to the problems that I had with audio when I upgraded to intrepid.

Revision history for this message
Hugo Alvarado (hugo102) wrote :

Hello,

I have been having this same issue, I tried sudo usermod -a -G pulse-rt $USER as suggested above, did not work. I disabled wifi and immediately stutter stopped and sound is perfect.

linux mint - release 6 felicia (ubuntu based) with gnome

No LSB modules are available.
Distributor ID: LinuxMint
Description: Linux Mint 6 Felicia - Main Edition
Release: 6
Codename: felicia

Linux hugo-laptop 2.6.27-11-generic #1 SMP Thu Jan 29 19:24:39 UTC 2009 i686 GNU/Linux

hugo@hugo-laptop ~ $ free -m
             total used free shared buffers cached
Mem: 1956 1897 58 0 41 632
-/+ buffers/cache: 1224 732
Swap: 486 7 478

00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 03)
02:00.0 Ethernet controller: Atheros Communications Inc. AR242x 802.11abg Wireless PCI Express Adapter (rev 01)

Daniel T Chen (crimsun)
Changed in pulseaudio:
status: Triaged → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package pulseaudio - 0.9.14-0ubuntu6

---------------
pulseaudio (0.9.14-0ubuntu6) jaunty; urgency=low

  * 0004_disable_autospawn.patch: Disable this patch. Doing so
    allows the daemon to spawn if not already running, which
    works around LP: #191027, #204272
  * 0012_clarify_driver_error_redirect_to_alsa_devs.patch:
    - Only log POLL* being set if tsched is used so that syslog
      isn't filled with innocuous messages when we set tsched=0
      (see 0030 below) (LP: #323712),
    - Hint 'linux' source package instead of 'alsa-driver' for
      Launchpad bug reports,
    - The debug-specific portion is only applicable to 0.9.14;
      0.9.15 enables a rate limiting module by default to work
      around this (and other) issues
  * 0029_fix_suspend_on_idle_null_race.patch: Handle sink case,
    too
  * 0030_set_tsched0.patch: Work around a shedload of (driver)
    bugs by falling back to interrupt-based buffer semantics
    (LP: #190754, #292880, #295519, #298494, #301755, #302964,
     LP: #319118, #323976, #324103, #326205, #326864)
  * Backport fixes from git HEAD:
    - 0031_fix_6chan_map.patch,
    - 0032_reinit_proplist.patch,
    - 0033_fix_pa-gcc-packedmalloc.patch,
    - 0034_bt_fixes.patch
  * Make invoking the stop target in the initscript not fail an
    upgrade (LP: #317921)
  * Previous upload (0.9.14-0ubuntu3) fixed LP: #321357
  * 01PulseAudio: use sudo -H to ensure that $HOME is, in fact,
    the user's when invoking pacmd for suspend/resume

 -- Daniel T Chen <email address hidden> Sun, 15 Feb 2009 02:35:26 -0500

Changed in pulseaudio:
status: Fix Committed → Fix Released
Revision history for this message
Connor Imes (ckimes) wrote :

I'm closing this task against paconfig since this bug was fixed in the pulseaudio package. Thank you.

Changed in paconfig:
status: Incomplete → Invalid
Revision history for this message
Daniel T Chen (crimsun) wrote :

released in jaunty's -11.38

Changed in linux (Ubuntu):
status: Fix Committed → Fix Released
Changed in gst-plugins-good:
status: New → Fix Released
Changed in gst-plugins-good:
importance: Unknown → Medium
Changed in pulseaudio (Mandriva):
importance: Unknown → Medium
Displaying first 40 and last 40 comments. View all 167 comments or add a comment.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.