Sound problems and CPU stepping
I'm trying to figure out some sound problems I've been having on my laptop. I noticed that every time my CPU usage went up too high, my sound would 'skip' ahead by several seconds - and apps outputting to ALSA's dmix would just lose sound capabilities altogether. At first I thought this might be a buffering problem, but increasing various buffer sizes (3 second buffer in xmms, dmix plugin buffer 65536, etc.), didn't make any difference.
Then, after brainstorming for a while about what could possibly happen due to increased CPU usage (increasing CPU usage caused skipping momentarily, then sound continued normally even with CPU usage still at 100%), I thought about CPU frequency stepping; I had the OnDemand governor enabled. After doing some experimenting with the userspace, powersave and performance governors, I determined that the problem occurrs when increasing CPU clock rate, and that decreasing clock rate has no effect.
I did some searching and found this link:
This seems to describe my problem, including the part about stopping and restarting the playback, but it doesn't say whether there's already a solution or not. Has anyone had this problem before, and does anyone know how to fix it?
Case Study 7: Audio/Video Playback
I know for a fact that switching CPU clock frequency while playing
back audio or video causes the sound to skip on my system. There are
two possible explanations for this:
a) the switching takes so long that something gets out of sync
b) the playback software has calibrated some internal loops for one
clock frequency, and running with another frequency makes the
My test cases are
- xmms with alsa backend
The alsa driver used is snd_intel8x0.
So the problem may even be in the alsa part, n
Stopping the playback and continuing playing (which internally closes
and re-opens the sound device) adapts the sound software to the new
clock frequency, so after that the sound runs smoothly.
- fix alsa, if the problem is there
- notify audio software of frequency switch
- make the software tolerant of CPU frequency
- avoid switching CPU frequency while audio playback is in progress
The fact that it is only the audio skipping while playing back video,
and not the video, indicates that the problem may be somewhere within
the alsa subsystem or hardware driver.
Thanks in advance,