http://bugs.winehq.org/show_bug.cgi?id=28622
--- Comment #59 from Jörg Höhle hoehle@users.sourceforge.net 2012-10-24 14:23:33 CDT --- Andrew, here's test data that I'm afraid kills your patch. Please run the mmdevapi render tests using testrun -v -i, i.e. with WINETEST_INTERACTIVE=1 and WINETEST_DEBUG=2 at least.
random native w7 machine from test.winehq: This is the behaviour that wine MUST reach in order to support the growing number of apps that use XA2 with minimal buffer size. render.c:2084: Should play 1000ms continuous tone with fragment size 480. render.c:2136: Released 48000=100x480 -960 frames at 48000 worth 980ms in 1008ms
PA (Ubuntu Hardy) with Andrew's patch -- crackling sound like noise render.c:2084: Should play 1000ms continuous tone with fragment size 480. render.c:2136: Released 32640=68x480 -480 frames at 48000 worth 670ms in 1204ms
dmix (Ubuntu Hardy) with Andrew's patch -- crackling sound like noise render.c:2136: Released 39360=82x480 -821 frames at 48000 worth 803ms in 1210ms render.c:2084: Should play 1000ms continuous tone with fragment size 480.
dmix (Ubuntu Hardy) wine-1.5.15 -- a little regular crackling render.c:2136: Released 48000=100x480 -480 frames at 48000 worth 990ms in 1196ms render.c:2084: Should play 1000ms continuous tone with fragment size 480.
PA (Ubuntu Hardy) wine-1.5.15 -- a little irregular crackling sound render.c:2084: Should play 1000ms continuous tone with fragment size 480. render.c:2136: Released 48000=100x480 -480 frames at 48000 worth 990ms in 1198ms
"worth 980ms" means that in 98% of cases, after an event tick, padding had decreased enough for the XA2 algorithm to add more frames. Any lower value means gaps and loss of sync between audio and video.
"in 1008ms" is elapsed time. If it differs too much from "worth" it means that gaps were introduced. Small gaps produce a crackling sound. If it differs too much from "should play" it means that the timer(Queue) used did not deliver on schedule. It could be jitter or systematic. That's when I investigated timers and wrote the CreateTimerQueue stabilisator patch.
With the TQ stabilisator patch, I get similar values with or without PA, with or without your patch: render.c:2136: Released 44160=92x480 -480 frames at 48000 worth 910ms in 1000ms render.c:2084: Should play 1000ms continuous tone with fragment size 480. even upto 960ms and almost continuous tone with PA: render.c:2136: Released 46560=97x480 -480 frames at 48000 worth 960ms in 1000ms render.c:2084: Should play 1000ms continuous tone with fragment size 480.
In summary, we already have a good tool to check how well the wine* drivers perform. It even allows to quantify the quality. As you can see, the winealsa drivers are not good enough yet on some systems.