On 6/21/21 6:52 PM, Giovanni Mascellani wrote:
The IAudioClient implementation from both Windows and winepulse.drv never sets the event more than once per period, which is usually around 10 ms long. Some codecs produce audio samples shorter than 10 ms, which currently result into the SAR not being able to keep up with the audio client, because the SAR never requests more than a sample per event cycle.
This patch causes the event to be set each time the available buffer space is less then half full, and each time a sample is received, so that short samples do not lead to audio client underruns.
How SAR handles that on Windows? Could we simply adjust a number of requests that sink sends, based on "audio client buffer size" / "incoming sample buffer size".
I don't think you should touch this event yourself, when it's supposed to be signaled by the audio system.
Of course it would be even better if the codecs didn't generate too short samples, because they uselessly require more CPU cycle, but we should handle them properly anyway.
This patch fixes audio stuttering problems in the logo videos of Borderlands 3, Deep Rock Galactic and probably other games.