Major mmdevapi and winmm audio bugs

Maarten Lankhorst m.b.lankhorst at gmail.com
Fri Feb 24 18:29:51 CST 2012


Hey Joerg,

Op 24-02-12 13:28, Joerg-Cyril.Hoehle at t-systems.com schreef:
> Hi,
>
> instead of Wine Weekly News (WWN, any taker?) you get monthly audio news.
>
> The surprising thing is: it looks like most audio bugs remaining in bugzilla
> are from the pre-mmdevapi era and have not been updated since mid-2011.
>
> - Using devices other than "default" (dmix or pulse):
> #29294 no sound with ALSA loopback  -- are they duplicates of each other
> #28781 loopback to Jack             -- or is one about DSound only?
>
> We have are several issues about crackling sound:
>
> - One definitely is caused by CreateTimerQueue which is not regular
>   enough or does not deliver 10ms, but 12ms callbacks.  This is in
>   #28723 which includes a work-around in comment #130
>   That may affect the Solaris machine on test.winehq.org too.
>
> - One is caused by a mmdevapi design error: the audio buffer we use is
>   simply too small, and Linux can't bear a regular 10ms rate.
>   Things got worse since the introduction of the Completely Fair Scheduler.
>   It can't even guarantee a regular 50ms one.  There's a need for a much
>   larger buffer.  That's why wine < 1.3.25 is giving steadier sound.
>   #29531 may be caused by this.
Really? I would say using rtkit for setting threads to realtime would be an aid for this..
> - Mac OS X 10.5.8 crackles constantly with dlls/mmdevapi/tests/render
>   I'd like somebody with 10.6 or .7 to perform the interactive test.
>   rm -f render.ok; WINETEST_INTERACTIVE=1 make render.ok
>
> - Lastly, there's PulseAudio
>   #28856 among others
>   I don't understand why I couldn't find bugs in PA's bugzilla, so I wrote some:
>    - https://bugs.freedesktop.org/show_bug.cgi?id=46296
>      About the need to restart the PA server from time to time
>    - https://bugs.freedesktop.org/show_bug.cgi?id=46297
>      PA's huge buffering causes issues with winmm
>    - https://bugs.freedesktop.org/show_bug.cgi?id=46412
>      How to obtain PA's typical 44100 rate?
>   Feel free to contribute if you know apps outside Wine with similar issues.
>   Surprisingly, users have reported improvements in the latest
>   wine-1.4rcX even when nothing changed, but also mentioned updates on
>   the PA and alsa_plugins side.  Perhaps that improved the situation.
>
>   I was pleased to see Wine's testsuite help find bugs in Pulse:
> http://lists.freedesktop.org/archives/pulseaudio-discuss/2012-February/012825.html
bug 46412 is worded wrong, pulseaudio can get native format just fine with PA_STREAM_FIX_RATE|PA_STREAM_FIX_FORMAT|PA_STREAM_FIX_CHANNELS, but maybe the pulse plugin doesn't respect it.

fwiw, IAudioClient::GetMixFormat works just fine with my winepulse driver, dsound doesn't seem to respect the rate, however.

If you feel like toying around, my git tree is at:

http://repo.or.cz/w/wine/multimedia.git

and contains a simple winepulse driver that sadly doesn't pass all tests yet, but I've not been motivated to fix the remaining ones since nobody seems to care about the driver and it will never get merged.
Most test failures are related to IAudioClock including silence time. Hacked away a bit more and I think I can fix it without being required to have a shadow buffer, using the write callback to signal when writing is done and keeping more track. The current "le sigh" commit solves it in a wrong way, but it's just a first stab at solving it.

I don't trust lockless, and I'm just using a simple mainloop thread based that matches the one pulseaudio uses everywhere, but manually created with CreateThread so normal wine calls would still work from it without weird bugs popping up.
> There are issues not always associated with a bug entry:
> - #29472 comment #12 DSound GetDevicePosition is not how it should be
> - Check OSS4 with and without vmix #28056 #28790
> - winmm handling huge latency (such as PA's) & when to send notifications
> - Issues with microphone capture?
> - DSound mixing and buffer sizes & padding vs. GetPosition
> - Deal with intermittent errors from ALSA etc. in mmdevapi, winmm and dsound
> - Device enumeration and PA preventing access to the underlying device
>   Is this known to cause no sound in an app (or only in our wave tests?)
> - various missing trailing sound with DSound #21209
> - #29369 strange issue involving PA and perhaps messaging
> - misc. losing sound: #28319 #25164 #28770
> - lead-out needed with dmix
> - Use lock-less design to reduce contention, cf. #29531, comment #7
> - multi-channel, 5:1 etc. in mmdevapi and DSound
> - Bugs in the quartz or winegstreamer area that I don't have on my radar
>
Winepulse supports 5.1 just fine, but dsound does not. I'm just using the dsound-openal replacement for now in games. It's a slightly patched version of
http://repo.or.cz/w/dsound-openal.git

~Maarten



More information about the wine-devel mailing list