wasapisrc: Fix capturing from some buggy audio drivers
authorNirbheek Chauhan <nirbheek@centricular.com>
Mon, 25 Nov 2019 15:49:59 +0000 (21:19 +0530)
committerTim-Philipp Müller <tim@centricular.com>
Thu, 28 Nov 2019 10:43:27 +0000 (10:43 +0000)
commit6a2dcdb71841d609ef6bdeef992cbd76c3dbc05c
treed15372ea953cc0f06824610dd01e9569088a82a2
parent0ac8ebdcd3a7a43e81c7716dc333f81082e32abb
wasapisrc: Fix capturing from some buggy audio drivers

Some audio drivers return varying amounts of data per ::GetBuffer
call, instead of following the device period that they've told us
about in `src_prepare()`.

Previously, we would just drop those extra buffers hoping that the
extra buffers were temporary (f.ex., a startup 'burst' of audio data).
However, it seems that some audio drivers, particularly on older
Windows versions (such as Windows 10 1703 and older) consistently
return varying amounts of data.

Use GstAdapter to smooth that out, and hope that the audio driver is
locally varying but globally periodic.

Initially reported in https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/808
sys/wasapi/gstwasapisrc.c
sys/wasapi/gstwasapisrc.h