• Giovanni Mascellani's avatar
    mf/sar: Allow requesting more than a sample per period. · adffa116
    Giovanni Mascellani authored
    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, so it is critical that the SAR is able to process more than
    a sample per period.
    
    This is not currently the case: a new sample is requested only in
    audio_renderer_render, which is executed (at most) once per period.
    This results in the SAR not being able to keep up with the audio
    client, and eventually underrunning.
    
    With this patch the SAR keeps a count of how many frames are
    currently queued, and a new sample is immediately requested if
    the internal queue has less than a buffer worth of frames.
    
    This patch fixes audio stuttering problems in the logo videos
    of Borderlands 3, Deep Rock Galactic and Mutant Year Zero.
    Signed-off-by: 's avatarGiovanni Mascellani <gmascellani@codeweavers.com>
    Signed-off-by: 's avatarNikolay Sivov <nsivov@codeweavers.com>
    Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
    adffa116
sar.c 61.2 KB