http://bugs.winehq.org/show_bug.cgi?id=27937
--- Comment #1 from Jörg Höhle hoehle@users.sourceforge.net 2011-08-05 04:20:23 CDT --- Created an attachment (id=35818) --> (http://bugs.winehq.org/attachment.cgi?id=35818) format + position + render tests
This is an update to attachment #35024 in bug #27393.
It's not yet ready for submission because of lack of complex todo_wine expressions, but it's slowly getting all the tests in that I want. It mostly passes on native in testbot job 13316.
It clearly shows: - native's IsFormatSupported - mmdevapi's GetPosition is not correct in Wine.
GetPosition is what's "currently playing through the speakers" http://www.winehq.org/pipermail/wine-devel/2011-August/091371.html
After playing for 1 second, GetPosition cannot be farther than nSamplesPerSec. The bug in Wine is that it's based on snd_pcm_avail_update, which is about buffer space, instead of snd_pcm_delay.
With dmix, it's funny that GetPosition is initially too far ahead but then calms down (see below). That's because there's no further buffering.
With PulseAudio, GetPosition yields values far away in the future. That alone explains why any app that tries to sync audio and video creates a huge lag. It's not the fault of PulseAudio.
Further bugs in Wine exhibited by the tests are: - Get/ReleaseBuffer OUT_OF_ORDER not correct yet; - ReleaseBuffer needs to check the size, otherwise it could overwrite memory! These should be fixed first before committing a test like mine because it requires convoluted if() todo_wine ok else ok to pass in Wine.
Surprisingly, the test seems to receive events even after Stop.
ALSA dmix output: render.c:745: Clock Frequency 48000 render.c:810: Test failed: Position 12473 too far after 100ms render.c:834: Test failed: Position 20665 too far after 200ms render.c:899: Test failed: Position 12721 too far after 100ms render.c:943: padding 902 position 21598 slept 450ms iteration 0 render.c:947: hpctime 451 pcpos 451 render.c:943: padding 18602 position 26398 slept 550ms iteration 1 render.c:947: hpctime 1251 pcpos 1251 render.c:996: position 83997 past underrun render.c:1006: hpctime 2251 after underrun
24000 samples after 0.5s play is ok.
ALSA Pulse output: render.c:810: Test failed: Position 24000 too far after 100ms render.c:831: Test failed: Position should have been further along... render.c:834: Test failed: Position 24000 too far after 200ms render.c:882: Test failed: Position 24000 too far after 100ms render.c:899: Test failed: Position 24000 too far after 100ms render.c:930: hpctime 353 after 350ms render.c:943: padding 0 position 22500 slept 450ms iteration 0 render.c:947: hpctime 454 pcpos 454 render.c:943: padding 0 position 45000 slept 550ms iteration 1 render.c:944: Test failed: Position 45000 too far after 550ms render.c:943: padding 0 position 67500 slept 650ms iteration 2 render.c:944: Test failed: Position 67500 too far after 650ms render.c:944: Test failed: Position 83898 too far after 750ms render.c:947: hpctime 1254 pcpos 1254 render.c:996: position 131844 past underrun render.c:1006: hpctime 2254 after underrun
PulseAudio's huge buffers eats a lot, but it cannot play faster than anybody else.