https://bugs.winehq.org/show_bug.cgi?id=42074
Bug ID: 42074 Summary: osu! - Audio latency regression (ALSA) Product: Wine Version: 2.0-rc3 Hardware: x86 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: -unknown Assignee: wine-bugs@winehq.org Reporter: yalterz@gmail.com Distribution: ---
Introduced in wine 1.9.10, still present in 2.0-rc3. Copying my description from a comment on another issue.
Hello, I'd like to describe my experience with the added sound latency. I'm the author of https://bugs.winehq.org/show_bug.cgi?id=40716
I'm using ALSA (no PulseAudio), with patched winealsa.drv for reduced latency. The patch is simply changing three constants at the top of mmdevdrv.c (DefaultPeriod, MinimumPeriod, EXTRA_SAFE_RT) to lower values (the ones that work for me: 22000, 22000, 11000 respectively).
On wine 1.9.9 and earlier where everything works fine, this results in an extremely low (almost none) audio latency, which is good. Reducing DefaultPeriod and MinimumPeriod lower makes the sound crackle a lot. Reducing EXTRA_SAFE_RT doesn't seem to change anything.
On wine 1.9.10 and above the "minimal" values of the constants seem to be around 10000 and 10000 for me, below that there's no sound at all (there's no crackling stage). The audio latency is much higher (both on "good" values from wine 1.9.9 and on the new minimal values) which makes the game feel much worse.
Arch Linux x64 32-bit wine prefix
https://bugs.winehq.org/show_bug.cgi?id=42074
Ivan Molodetskikh yalterz@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |yalterz@gmail.com
https://bugs.winehq.org/show_bug.cgi?id=42074
Ivan Molodetskikh yalterz@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Hardware|x86 |x86-64
https://bugs.winehq.org/show_bug.cgi?id=42074
Ivan Molodetskikh yalterz@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Component|-unknown |directx-dsound
--- Comment #1 from Ivan Molodetskikh yalterz@gmail.com --- Did regression testing, this seems to be the bad commit:
569ed159b0ab31121d9aab95bf1d3ac49675f1ca is the first bad commit commit 569ed159b0ab31121d9aab95bf1d3ac49675f1ca Author: Maarten Lankhorst wine@mblankhorst.nl Date: Thu May 12 08:43:23 2016 -0500
dsound: Use AudioClient buffer statistics.
Signed-off-by: Andrew Eikum aeikum@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
:040000 040000 87546253bd4a401be4757d8f9b4ff4aaab80754d 31288b14ad6d14f9f7bcbf956613ff82a23b0d2a M dlls
https://bugs.winehq.org/show_bug.cgi?id=42074
Jeff Zaroyko jeffz@jeffz.name changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords| |download, regression Regression SHA1| |569ed159b0ab31121d9aab95bf1 | |d3ac49675f1ca CC| |wine@mblankhorst.nl URL| |https://osu.ppy.sh/p/downlo | |ad
https://bugs.winehq.org/show_bug.cgi?id=42074
Austin English austinenglish@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |aeikum@codeweavers.com
https://bugs.winehq.org/show_bug.cgi?id=42074
--- Comment #2 from Andrew Eikum aeikum@codeweavers.com --- Thanks for the report, Ivan. Could you attach a log showing the problem with the channels from https://wiki.winehq.org/Sound? Just a few seconds should be fine, the log will get large quickly.
Also, please attach the diff you use when gathering the log.
https://bugs.winehq.org/show_bug.cgi?id=42074
--- Comment #3 from Ivan Molodetskikh yalterz@gmail.com --- (In reply to Andrew Eikum from comment #2)
Also, please attach the diff you use when gathering the log.
What does "diff" mean here?
https://bugs.winehq.org/show_bug.cgi?id=42074
--- Comment #4 from Andrew Eikum aeikum@codeweavers.com --- (In reply to Ivan Molodetskikh from comment #3)
(In reply to Andrew Eikum from comment #2)
Also, please attach the diff you use when gathering the log.
What does "diff" mean here?
The changes to winealsa that you are making. "git diff" should show you, if you haven't committed them.
https://bugs.winehq.org/show_bug.cgi?id=42074
--- Comment #5 from Ivan Molodetskikh yalterz@gmail.com --- Created attachment 56647 --> https://bugs.winehq.org/attachment.cgi?id=56647 Wine log: good (crackling, no latency)
The mmdevdrv.c values are set very low for good comparison. This produces severe crackling in the good version.
https://bugs.winehq.org/show_bug.cgi?id=42074
--- Comment #6 from Ivan Molodetskikh yalterz@gmail.com --- Created attachment 56648 --> https://bugs.winehq.org/attachment.cgi?id=56648 Wine log: bad (no crackling, big latency)
The mmdevdrv.c values are set very low for good comparison. This produces severe crackling in the good version.
https://bugs.winehq.org/show_bug.cgi?id=42074
--- Comment #7 from Ivan Molodetskikh yalterz@gmail.com --- (In reply to Andrew Eikum from comment #2)
Thanks for the report, Ivan. Could you attach a log showing the problem with the channels from https://wiki.winehq.org/Sound? Just a few seconds should be fine, the log will get large quickly.
Also, please attach the diff you use when gathering the log.
Attached the logs. Here's the mmdevdrv.c patch I used:
56,58c56,58 < static const REFERENCE_TIME DefaultPeriod = 100000; < static const REFERENCE_TIME MinimumPeriod = 50000; < #define EXTRA_SAFE_RT 40000 ---
static const REFERENCE_TIME DefaultPeriod = 13000; static const REFERENCE_TIME MinimumPeriod = 13000; #define EXTRA_SAFE_RT 8000
Note that the values are set extremely low for good comparison which produces severe crackling in the good version.
https://bugs.winehq.org/show_bug.cgi?id=42074
--- Comment #8 from Andrew Eikum aeikum@codeweavers.com --- Created attachment 56649 --> https://bugs.winehq.org/attachment.cgi?id=56649 dsound: Don't queue more than three periods
Thanks, I think I see the problem. Can you try applying this patch on top of latest Wine and see if it helps?
https://bugs.winehq.org/show_bug.cgi?id=42074
--- Comment #9 from Ivan Molodetskikh yalterz@gmail.com --- (In reply to Andrew Eikum from comment #8)
Created attachment 56649 [details] dsound: Don't queue more than three periods
Thanks, I think I see the problem. Can you try applying this patch on top of latest Wine and see if it helps?
It seems to have fixed the latency! And there's no crackling, too (even on even lower values than the ones I tested).
https://bugs.winehq.org/show_bug.cgi?id=42074
--- Comment #10 from Andrew Eikum aeikum@codeweavers.com --- (In reply to Ivan Molodetskikh from comment #9)
(In reply to Andrew Eikum from comment #8)
Created attachment 56649 [details] dsound: Don't queue more than three periods
Thanks, I think I see the problem. Can you try applying this patch on top of latest Wine and see if it helps?
It seems to have fixed the latency! And there's no crackling, too (even on even lower values than the ones I tested).
So, just to be clear, that patch fixes this bug for you, right?
I plan to send it, but I need to test it some more as it changes timing in dsound, which is a really fragile area.
https://bugs.winehq.org/show_bug.cgi?id=42074
--- Comment #11 from Ivan Molodetskikh yalterz@gmail.com --- (In reply to Andrew Eikum from comment #10)
(In reply to Ivan Molodetskikh from comment #9)
(In reply to Andrew Eikum from comment #8)
Created attachment 56649 [details] dsound: Don't queue more than three periods
Thanks, I think I see the problem. Can you try applying this patch on top of latest Wine and see if it helps?
It seems to have fixed the latency! And there's no crackling, too (even on even lower values than the ones I tested).
So, just to be clear, that patch fixes this bug for you, right?
I plan to send it, but I need to test it some more as it changes timing in dsound, which is a really fragile area.
Yes, I've been playing osu! with this patch for the past 5 days and it works really well.
https://bugs.winehq.org/show_bug.cgi?id=42074
--- Comment #12 from Ivan Molodetskikh yalterz@gmail.com --- (In reply to Andrew Eikum from comment #10)
(In reply to Ivan Molodetskikh from comment #9)
(In reply to Andrew Eikum from comment #8)
Created attachment 56649 [details] dsound: Don't queue more than three periods
Thanks, I think I see the problem. Can you try applying this patch on top of latest Wine and see if it helps?
It seems to have fixed the latency! And there's no crackling, too (even on even lower values than the ones I tested).
So, just to be clear, that patch fixes this bug for you, right?
I plan to send it, but I need to test it some more as it changes timing in dsound, which is a really fragile area.
I also tried measuring audio latency and it seemed to be about the same as the good 1.9.9 version.
https://bugs.winehq.org/show_bug.cgi?id=42074
fjfrackiewicz@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |fjfrackiewicz@gmail.com
--- Comment #13 from fjfrackiewicz@gmail.com --- Looks like the patch got committed:
http://source.winehq.org/git/wine.git/commit/0190c50a8ca14e21355befc212b60f6...
https://bugs.winehq.org/show_bug.cgi?id=42074
--- Comment #14 from Andrew Eikum aeikum@codeweavers.com --- Yup. If you have a minute, Ivan, please test the latest wine-git or Wine 2.0-rc4 when it's released and confirm it's fixed for you.
https://bugs.winehq.org/show_bug.cgi?id=42074
--- Comment #15 from Ivan Molodetskikh yalterz@gmail.com --- (In reply to Andrew Eikum from comment #14)
Yup. If you have a minute, Ivan, please test the latest wine-git or Wine 2.0-rc4 when it's released and confirm it's fixed for you.
Tried dsound & mmdevdrv from latest git (da5a0b76117f938aaeca3471ed69c5e50b73c19c) ontop of 2.0-rc3 (so I don't have to compile everything else (that's also how I tested before)), works fine.
https://bugs.winehq.org/show_bug.cgi?id=42074
winetest@luukku.com changed:
What |Removed |Added ---------------------------------------------------------------------------- CC| |winetest@luukku.com
--- Comment #16 from winetest@luukku.com --- (In reply to Ivan Molodetskikh from comment #15)
(In reply to Andrew Eikum from comment #14)
Yup. If you have a minute, Ivan, please test the latest wine-git or Wine 2.0-rc4 when it's released and confirm it's fixed for you.
Tried dsound & mmdevdrv from latest git (da5a0b76117f938aaeca3471ed69c5e50b73c19c) ontop of 2.0-rc3 (so I don't have to compile everything else (that's also how I tested before)), works fine.
Since you are the original author of this bug report, could you solve this as fixed?
https://bugs.winehq.org/show_bug.cgi?id=42074
Ivan Molodetskikh yalterz@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|UNCONFIRMED |RESOLVED
--- Comment #17 from Ivan Molodetskikh yalterz@gmail.com --- (In reply to winetest from comment #16)
(In reply to Ivan Molodetskikh from comment #15)
(In reply to Andrew Eikum from comment #14)
Yup. If you have a minute, Ivan, please test the latest wine-git or Wine 2.0-rc4 when it's released and confirm it's fixed for you.
Tried dsound & mmdevdrv from latest git (da5a0b76117f938aaeca3471ed69c5e50b73c19c) ontop of 2.0-rc3 (so I don't have to compile everything else (that's also how I tested before)), works fine.
Since you are the original author of this bug report, could you solve this as fixed?
Sure.
https://bugs.winehq.org/show_bug.cgi?id=42074
Andrew Eikum aeikum@codeweavers.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Fixed by SHA1| |0190c50a8ca14e21355befc212b | |60f6409594aec
--- Comment #18 from Andrew Eikum aeikum@codeweavers.com --- Thanks a lot, Ivan! Glad we got this resolved for 2.0 :)
https://bugs.winehq.org/show_bug.cgi?id=42074
Alexandre Julliard julliard@winehq.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |CLOSED
--- Comment #19 from Alexandre Julliard julliard@winehq.org --- Closing bugs fixed in 2.0-rc4.