http://bugs.winehq.org/show_bug.cgi?id=29299
--- Comment #8 from Jörg Höhle hoehle@users.sourceforge.net 2012-01-23 16:01:31 CST --- I'll need more time to think, but one thing is definitively wrong with the second patch. The callback is never allowed to pad more than one mmdevapi period worth of frames, because the next callback could see them supplied, hence the patch will cause abnormal effects when ALSA period > mmdevapi period.
Also, you should need no HeapAlloc. Prealloc temp_buffer with max(ALSA,mmdevapi)period (also good for capture). If (This->getbuf_last>= 0) use temp_buffer otherwise there's room in the normal one.