[PATCH] winealsa.drv: Optimizations and bug fixes.
tom at dbservice.com
Sat Feb 23 15:30:28 CST 2008
There is a bug in how WAVEHDR->reserved is computed, it is possible that
it is set to a value that can never have been reached (when a WAVEHDR is
only partially written, then ->reserved is set to 'dwWrittenTotal +
WAVEHDR->dwBufferSize' when it should be set to 'dwWrittenTotal +
WAVEHDR->dwBufferSize - dwPartialOffset'). Anyhow, it doesn't make sense
to update the value after each write as it is fixed as long as the
header is wwo->lpPlayPtr. The value is now computed only once, when the
header is prepared for playback.
Only write data if ALSA has space for one period or more available. This
aims at reducing syscalls (write) with small amounts of data. Given that
the period usually is very short (10ms), that value could be increased
even further, to let's say ten periods. But at this time, one period
seems like a reasonable value as the minimum.
Sleep as long as possible between wakeups. The old code used to wake up
every 'period' (which is usually 10ms), even if the DSP had been pased
data for much longer to consume. Now the code checks how much data the
DSP has ready for playback, and wakes up just before it runs out of
data. That means when the application has supplied enough data, in big
enough WAVEHDRs, the driver will be able to sleep for up to ~480ms
(500ms is the maximum buffer size, plus the code wakes up two periods
before the DSP runs out of data - to make up for possible delays in
Tested with foobar2000, World of Warcraft, winmm wave test.
CC mlankhorst as he is the current maintainer.
dlls/winealsa.drv/waveout.c | 76
1 files changed, 58 insertions(+), 18 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 5249 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20080223/28d9a620/attachment.bin
More information about the wine-patches