Bug 487270 - Sound server keeps closing and opening the sound card for playing each sound effect, causing delays and audible "pops"
Summary: Sound server keeps closing and opening the sound card for playing each sound ...
Alias: None
Product: Fedora
Classification: Fedora
Component: pulseaudio
Version: rawhide
Hardware: x86_64
OS: Linux
Target Milestone: ---
Assignee: Lennart Poettering
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2009-02-25 08:42 UTC by Oded Arbel
Modified: 2009-03-08 14:39 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2009-02-26 20:16:44 UTC

Attachments (Terms of Use)
strace of pulseaudio daemon (289.07 KB, text/plain)
2009-02-25 09:30 UTC, Oded Arbel
no flags Details

Description Oded Arbel 2009-02-25 08:42:06 UTC
Description of problem:
When enabling sound notifications through the GNOME Sound Preferences dialog, and also generally when sound is heard intermittently (i.e. - not a continuous video or music playing), the sound server seems to close the audio hardware every time the audio stops, and resets the hardware before playing each new sounds.

This causes two annoying effects (at least on my hardware - standard HDA intel chipset): 
* When audio just starts there is a noticeable delay before the sound plays - this is very noticeable when the audio is a simple audio notification (for example when enabling audio notifications on buttons and menus).
* Everytime the hardware is being reset, an audible popping sound is heard on the speakers. With previous Fedora versions this used to happen only when the session starts and was negligible but in Fedora 11 (with sound notifications enabled and while no other audio is playing) this popping artifact can be heard several times a minute.

I'm not sure if this is the fault of pulseaudio or some other component, but I chose pulseaudio because I know its the sound server for GNOME.

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. In Fedora 11 alpha, enable sound notifications on buttons in the GNOME sound preferences dialog.
2. Make sure volume is set correctly, but don't play any continuous audio stream.
3. Work slowly through some dialogs and menus - make sure to pause a few seconds between each click.
Actual results:
On some hardware the opening and closing of the audio hardware can be experienced as loud pops are heard from the speakers when the hardware is being reset. Also there sometime a noticeable latency between the mouse interaction and the sound produced, when the hardware has to be reset before playing the sound.

Comment 1 Oded Arbel 2009-02-25 09:30:52 UTC
Created attachment 333144 [details]
strace of pulseaudio daemon

Attached is an strace of the pulseaudio daemon during which an idle desktop was trying to invoke a single sound notification. 

At the top of the strace the pulseaudio daemon can be seen initting the audio hardware, and at the bottom of the trace you can see it closing the audio hardware ( close(57) and close(62) ).

This whole process is executed each time a single beep is sent from the desktop - looks a bit sub-optimal to me. Also, on my hardware (I've just started to notice) the closing of the sound card also triggers a "pop artifact" although it is shorter and less loud.

Comment 2 Oded Arbel 2009-02-25 11:34:20 UTC
I've managed to work around the problem by commenting out 'load-module module-suspend-on-idle' in the .pa files on /etc/pulse, but this was the same configuration as in Fedora 10 which didn't have that problem so I'm pretty sure this isn't the right course of action.

I'd be happy to provide any additional information required for resolving this issue, or run any tests on my system. I'm going to try to install Fedora 11 alpha on a few different computers to see if I can reproduce this on other types of hardware.

Comment 3 Lennart Poettering 2009-02-26 20:16:44 UTC
We close the audio device when idle because that is the best way to save power. Opening a device is very fast.

If opening a device causes hearable clicking this is considered a driver bug. Please file a seperate bug about this against alsa/kernel.

Comment 4 Oded Arbel 2009-02-26 22:13:01 UTC
Thanks for the response. I'd like to comment that there *is* a noticeable delay when opening the sound device - with sound notifications for buttons enabled, one would expect the sound to be heard as soon as button is clicked, but if pulseaudio has to open the device before it can play - then at least on my (granted, not that new) machine there is a lag of maybe even a second at times. Its very noticeable.

Secondly, lets assume that both the opening delay and the audible clicking during device opening can both be fixed on the driver side. How likely is this fix to be released in time for Fedora 11? In the mean time, Fedora 11 will be left with a very poor user experience in regards for audio.

I've tested this with a couple of more (and newer) machines, both with intel ICH9 the same as mine, and they both exhibit the audible device initialization and (to a lesser degree) the sound latency. Intel's integrated audio devices are *very* common, it would be a shame if most users would experience this easy to fix issue.

Please reconsider opening this bug report.

Comment 5 Lennart Poettering 2009-02-28 09:23:02 UTC
If this really takes 1s for you then something is very very broken for your driver. Please file a bug against the driver.

PA has been closing audio devices as idle since about the beginning of time. Thus this certainly is no regression for F11 in PA. If it is a regression then certainly in the drivers, not in PA.

Please file a bug against the ALSA drivers, thank you.

Comment 6 Oded Arbel 2009-03-08 14:39:36 UTC
I've opened a bug with ALSA ( https://bugtrack.alsa-project.org/alsa-bug/view.php?id=4441 ) though I'm still not sure what could cause this regression: are you suggesting that ALSA's support for intel HDA codec has gotten much worse in the last point release (from F10's 1.0.18rc3 to F11 1.0.19)?

Note You need to log in before you can comment on or make changes to this bug.