PortAudio / portaudio

PortAudio is a cross-platform, open-source C language library for real-time audio input and output.
Other
1.37k stars 286 forks source link

wasapi: Workaround for the Realtek driver "Mono" bug #934

Open dmitrykos opened 1 week ago

dmitrykos commented 1 week ago

Workaround for the Realtek driver bug when driver mistakenly accepts Mono format with IAudioClient_IsFormatSupported() while subsequently fails in IAudioClient_Initialize().

It is a long-lasting issue #875 which was resolved with a kind debugging help by @arkadijs.

Closes #875.

arkadijs commented 1 week ago

Confirming, this fixes the issue with the buggy? Realtek driver.

dmitrykos commented 6 days ago

@arkadijs thank you very much for testing. Now let's wait for a review from @RossBencina and @philburk to get this PR approved.

dmitrykos commented 2 days ago

I have not tested it, but it looks OK. my main concern would be whether this could introduce a regression on other drivers. is it passing the PortAudio pa_loopback tests?

Great that you mentioned it! I modified workaround to exclude Input mode as this driver bug is related to Output only.

As to pa_loopback - it fails for WASAPI on [Loopback] device because of this #935 issue - when there is no audio sent to WASAPI internal mixer from some opened audio streams the attempt to read data from [Loopback] device will timeout i.e. PaQa_RunInputOnly() fails. But it has nothing to do with workaround of this PR - tested.

I propose to discuss the timeout of [Loopback] WASAPI device in #935, there we can also discuss whether a workaround needed in pa_loopback implementation for loopback devices which timeout without audio data collected from other opened audio streams, or perhaps PA WASAPI needs some workaround for this specific behavior.

This PR looks ok for me to commit.