mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
wasapi2: Fix choppy rendering
This reverts questionable commit 009bc15f33
which looks completely wrong.
The GstWasapi2RingBuffer:buffer_size variable is used to
calculate available buffer size we can write
(i.e., available size = buffer_size - padding_size).
But the commit makes the size to be exactly same as buffer period.
Then, it can confuse this element as if the endpoint buffer is full on
I/O event callback (if padding size is equal to buffer period)
but it's not true.
Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2870
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6132>
This commit is contained in:
parent
fb02516b75
commit
93f0135798
1 changed files with 5 additions and 9 deletions
|
@ -1045,6 +1045,7 @@ gst_wasapi2_ring_buffer_acquire (GstAudioRingBuffer * buf,
|
|||
ComPtr < IAudioStreamVolume > audio_volume;
|
||||
GstAudioChannelPosition *position = nullptr;
|
||||
guint period = 0;
|
||||
gint segtotal = 2;
|
||||
|
||||
GST_DEBUG_OBJECT (buf, "Acquire");
|
||||
|
||||
|
@ -1139,18 +1140,13 @@ gst_wasapi2_ring_buffer_acquire (GstAudioRingBuffer * buf,
|
|||
|
||||
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->segtotal = 2;
|
||||
segtotal = (self->buffer_size / period);
|
||||
spec->segtotal = MAX (segtotal, 2);
|
||||
|
||||
GST_INFO_OBJECT (self,
|
||||
"Buffer size: %d frames, period: %d frames, segsize: %d bytes",
|
||||
self->buffer_size, period, spec->segsize);
|
||||
"Buffer size: %d frames, period: %d frames, segsize: %d bytes, "
|
||||
"segtotal: %d", self->buffer_size, period, spec->segsize, spec->segtotal);
|
||||
|
||||
if (self->device_class == GST_WASAPI2_CLIENT_DEVICE_CLASS_RENDER) {
|
||||
ComPtr < IAudioRenderClient > render_client;
|
||||
|
|
Loading…
Reference in a new issue