mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-05-29 21:37:54 -04:00
pulse: handle wraparound near the end correctly
If offset is near MAXLENGTH, we can read past the end of the buffer. Use the ringbuffer API to correctly wraparound.
This commit is contained in:
parent
e5dda30b38
commit
a585b117da
1 changed files with 2 additions and 1 deletions
|
|
@ -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, size);
|
||||
spa_ringbuffer_read_data(NULL, s->buffer, MAXLENGTH,
|
||||
p->offset % MAXLENGTH, d, size);
|
||||
|
||||
p->offset += size;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue