mirror of https://github.com/mpv-player/mpv
mp_ring: make mp_ring_read_cb provide an exact amount of bytes
The previous code would pass down `len` instead of `read_len` which, in theory, could be more than what was available in the buffer.
This commit is contained in:
parent
dc4dcf34e5
commit
9d9bcfa4f3
|
@ -99,7 +99,7 @@ int mp_ring_read_cb(struct mp_ring *buffer, void *ctx, int len,
|
|||
int read_len = FFMIN(len, buffered);
|
||||
int read_ptr = mp_ring_get_rpos(buffer) % size;
|
||||
|
||||
func(ctx, buffer->buffer + read_ptr, len);
|
||||
func(ctx, buffer->buffer + read_ptr, read_len);
|
||||
|
||||
return mp_ring_drain(buffer, read_len);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue