'Twas brillig, and Bankim Bhavsar at 17/09/09 01:27 did gyre and gimble:
On a side-note there seems to be some change in PulseAudio bring shipped with Ubuntu 9.10 over 9.04 that affects sound playback quality. With PulseAudio in 9.10, programmed DMA buffer is 64k and num_periods is always 1 and thereby number of interrupts generated per sec is just 2 for 16-bit, 44Khz, stereo. IMO the number interrupts is too low and this leads to under-runs. Whats the reason for choosing always 1 period and having large buffer/period size (power-savings?)?
If I disable PulseAudio in 9.10, programmed DMA buffer is 64k with 16 periods each of size 4k and virtual sound device would generate 46-48 interrupts per sec. With this setting sound playback quality is good.
I'm not sure about Ubuntu setup but the disabling of interupts and using timers is indeed all about power savings. The wakeup time is dynamically adjusted when an underrun occurs so as to avoid it in the future.
Some Nokia/Intel folks (can't remember which) are experimenting with very large latencies (e.g. up to about 10s) in order to get maximum power savings.
You can read more about it here: http://0pointer.de/blog/projects/pulse-glitch-free.html
You can disable this timer based scheduling by passing the argument tsched=0 to module-hal-detect or module-udev-detect (whichever is in use: the latter obsoleting the former) in /etc/pulse/default.pa
Col