pulse-tunnel: fix index after overrun

First advance the index, then fix the avail value or else we don't end
up changing the index at all.
This commit is contained in:
Wim Taymans 2023-08-31 11:39:54 +02:00
parent 9f66c42d1f
commit f25da522a4

View file

@ -399,8 +399,8 @@ static void capture_stream_process(void *d)
if (avail < (int32_t)size) if (avail < (int32_t)size)
memset(bd->data, 0, size); memset(bd->data, 0, size);
if (avail > (int32_t)RINGBUFFER_SIZE) { if (avail > (int32_t)RINGBUFFER_SIZE) {
avail = impl->target_buffer;
index += avail - impl->target_buffer; index += avail - impl->target_buffer;
avail = impl->target_buffer;
} }
if (avail > 0) { if (avail > 0) {
avail = SPA_ROUND_DOWN(avail, impl->frame_size); avail = SPA_ROUND_DOWN(avail, impl->frame_size);