ntdll: Stabilize CreateTimerQueueTimer callbacks over time. (try 2)
Joerg-Cyril.Hoehle at t-systems.com
Joerg-Cyril.Hoehle at t-systems.com
Wed Mar 7 03:03:38 CST 2012
Hi,
[try 2: exdented queue_move_timer to have the code structure appear clearly.]
This is one of the most important audio-related late pre-1.4 patches.
It fixes #30071, #28856, allows to close #28723 and perhaps every other bug report
about occasional or continuous crackling sound from ALSA, e.g. #28622 comment #34 or #28282.
All w7 XAudio2 clients are affected. Winmm less so, because apps tend to write more than one period
at a time. DSound benefits too, also it's not cured yet as it does not use mmdevapi period sizes,
GetCurrentPAdding and GetPosition like I believe it should.
The key part is
fire next = t->expire + t->period (like winmm:time functions)
instead of
fire next = now + t->period.
to provide a stable rate (on average) over time.
Googling CreateTimerQueuerTimer, you'll find a few posting where its stability is discussed,
although there's no master's voice. There's also A. Eikum's observation:
http://www.winehq.org/pipermail/wine-devel/2012-February/094457.html
Visit testbot job #17175
https://testbot.winehq.org/JobDetails.pl?Key=17175
and you'll see that Vista/w2k8/w7 adapt the intervals to maintain the average too, unlike w2k/xp.
I've left
fire next < now ? now + t->period
such that when the system is overloaded, the current behaviour (now + period) is maintained.
This particular case is not backed by tests, it's simply what the old code always did.
Winmm:time* behave differently when overloaded: if late by 100ms when trying to deliver 10ms
events, it'll trigger 10 times in a row. This may be ok for multimedia winmm timers issued from a
single timer thread, but I feel that's not ok for a mechanism backed by N worker threads which
would then run in parallel. That wouldn't help an already overloaded system.
Regards,
Jörg Höhle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-ntdll-Stabilize-CreateTimerQueueTimer-callbacks-over.patch
Type: application/octet-stream
Size: 1497 bytes
Desc: 0002-ntdll-Stabilize-CreateTimerQueueTimer-callbacks-over.patch
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20120307/da9aa741/attachment.obj>
More information about the wine-patches
mailing list