wasapi2ringbuffer: Fix for desynced buffer-size and segsize

GstAudioRingBufferSpec::segsize has been configured by using
device period but GstWasapi2RingBuffer was referencing the
buffer size returned by IAudioClient::GetBufferSize()
which is most likely larger than device period.
Fixing to sync them.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1533>
This commit is contained in:
Seungha Yang 2022-01-18 03:03:30 +09:00
parent e7c9960783
commit 009bc15f33

View file

@ -1053,6 +1053,12 @@ gst_wasapi2_ring_buffer_acquire (GstAudioRingBuffer * buf,
g_assert (period > 0); g_assert (period > 0);
if (self->buffer_size > period) {
GST_INFO_OBJECT (self, "Updating buffer size %d -> %d", self->buffer_size,
period);
self->buffer_size = period;
}
spec->segsize = period * GST_AUDIO_INFO_BPF (&buf->spec.info); spec->segsize = period * GST_AUDIO_INFO_BPF (&buf->spec.info);
spec->segtotal = 2; spec->segtotal = 2;