Skip to content
Snippets Groups Projects
Commit 53c25ee0 authored by Martin Storsjö's avatar Martin Storsjö
Browse files

aviobuf: Discard old buffered, previously read data in ffio_read_partial


This makes RTP custom IO work properly with pure read-only
AVIOContexts as well.

Signed-off-by: default avatarMartin Storsjö <martin@martin.st>
parent e96406ed
Branches
Tags
No related merge requests found
......@@ -506,6 +506,13 @@ int ffio_read_partial(AVIOContext *s, unsigned char *buf, int size)
len = s->buf_end - s->buf_ptr;
if (len == 0) {
/* Reset the buf_end pointer to the start of the buffer, to make sure
* the fill_buffer call tries to read as much data as fits into the
* full buffer, instead of just what space is left after buf_end.
* This avoids returning partial packets at the end of the buffer,
* for packet based inputs.
*/
s->buf_end = s->buf_ptr = s->buffer;
fill_buffer(s);
len = s->buf_end - s->buf_ptr;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment