xrun handling in winealsa.drv
Timofei V. Bondarenko
tim at ipi.ac.ru
Tue Nov 6 08:11:01 CST 2007
Hi.
I've noticed the winealsa does not handle alsa XRUNs.
In the case of XRUN application hangs.
That's happened because return value of snd_pcm_avail_update() is not
checked.
For example:
wavein.c
175 DWORD bytes;
180 /* read all the fragments accumulated so far */
181 frames = snd_pcm_avail_update(wwi->pcm);
182 bytes = snd_pcm_frames_to_bytes(wwi->pcm, frames);
waveout.c
476 DWORD availInQ;
479 availInQ = snd_pcm_avail_update(wwo->pcm);
482 if (availInQ > 0) {
The snd_pcm_avail_update() returns a _signed_ type and it really does
return negative number -EPIPE in the case of XRUN.
More over, any return value of less than period_size may indicate XRUN
state too.
The snd_pcm_state() may help then.
Th dsoutput.c and dscapture.c do exactly the same wrong thigs.
BTW, using DWORD type causes problems.
Following fragment is from wavein.c too:
177 DWORD read;
181 frames = snd_pcm_avail_update(wwi->pcm);
182 bytes = snd_pcm_frames_to_bytes(wwi->pcm, frames);
193 read = wwi->read(wwi->pcm, lpWaveHdr->lpData +
194 bytesRead = snd_pcm_frames_to_bytes(wwi->pcm,
197 if (bytesRead != (DWORD) -1)
This is obviously will not work as expected.
I hope someone will fix these issues :)
Regards,
Tim.
More information about the wine-devel
mailing list