diff options
author | Martin Storsjö <martin@martin.st> | 2013-01-02 00:25:37 +0200 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2013-01-03 15:17:10 +0200 |
commit | 53c25ee0736497b46bb76064cc2c84c976b2d295 (patch) | |
tree | a37c9fe8af49027d0cd2fa389e93f849a0b7b8af /libavformat | |
parent | e96406eda4f143f101bd44372f7b2d542183000a (diff) | |
download | ffmpeg-53c25ee0736497b46bb76064cc2c84c976b2d295.tar.gz |
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: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/aviobuf.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 8f3e511fc4..d2eaf36b87 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -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; } |