http://bugs.winehq.org/show_bug.cgi?id=28723
--- Comment #72 from Jörg Höhle hoehle@users.sourceforge.net 2011-12-07 04:19:28 CST --- Created attachment 37844 --> http://bugs.winehq.org/attachment.cgi?id=37844 GetPosition with snd_pcm_delay
I spent days fighting an old PulseAudio trying to figure a repeatable way to have avail_update or snd_pcm_delay produce reasonable values after underrun recovery. No deal.
Here's a version of GetPosition that exhibits the following properties: - monotonically increasing (not documented, but I read in dlls/ Quartz' GetPosition has such a requirement); - protection against garbage delay data; - never using ALSA padding, because that can't be relied upon in PulseAudio after an underrun; - works perfectly with dmix, reasonably well with old Pulseaudio -- don't dump old Linux distributions! - after IAC_Stop, freeze to sum_written - mmdevapi_padding, comment #65.
The latter causes 2 of my tests to fail ("position X too far after only 100ms") for as long as Wine forwards a lot of audio down to ALSA, whereas native feeds 10ms at a time.
Before submitting, all I plan to change is to move TRACE after LeaveCS. I've not yet tested whether it passes tests on top of current git. So far, I used it with patches from comment #54. It would be nice if it could be independent, though ("with GP fixed, let's tackle GCP").
Regarding set_hw_params_period_*, I'm leaning towards this patch: if(duration <= 80ms) /* app shows it wants tight timing */ set_hw_params_period_time max(20ms); /* abort on error not shown */ set_hw_params_period_time_near(10ms); 2 calls because _near won't prevent using 100ms if the device doesn't support smaller periods. _max will ensure it fails.