pulse: handle wraparound near the end correctly

If offsetis near MAXLENGTH, we can still read past the end of the
buffer. Use the ringbuffer to wraparound.
This commit is contained in:
Wim Taymans 2026-04-30 14:14:59 +02:00
parent b9b93f3cdb
commit 32648b7cc7

View file

@ -100,7 +100,8 @@ static void sample_play_stream_process(void *data)
if (b->requested)
size = SPA_MIN(size, b->requested * p->stride);
memcpy(d, s->buffer + (p->offset % MAXLENGTH), size);
spa_ringbuffer_read_data(NULL, s->buffer, MAXLENGTH,
p->offset % MAXLENGTH, d, size);
p->offset += size;