diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-03-26 23:58:48 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-03-26 23:58:48 +0100 |
commit | 61b5ef7754132c43e6db1a273066e82c469fa39c (patch) | |
tree | d2040eba8f7916ab2c5293a7590e04fcd497898e /libavformat/aviobuf.c | |
parent | 0d4a66ee7f48c65ac67f4d91c8f8f2bfd47afa0d (diff) | |
download | ffmpeg-61b5ef7754132c43e6db1a273066e82c469fa39c.tar.gz |
libavformat/aviobuf: keep track of the original buffer-size and restore it after probe/ensure-seekback
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/aviobuf.c')
-rw-r--r-- | libavformat/aviobuf.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 7e1bfcd1eb..be4dd7acea 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -78,6 +78,7 @@ int ffio_init_context(AVIOContext *s, int64_t (*seek)(void *opaque, int64_t offset, int whence)) { s->buffer = buffer; + s->orig_buffer_size = s->buffer_size = buffer_size; s->buf_ptr = buffer; s->opaque = opaque; @@ -434,14 +435,14 @@ static void fill_buffer(AVIOContext *s) } /* make buffer smaller in case it ended up large after probing */ - if (s->read_packet && s->buffer_size > max_buffer_size) { + if (s->read_packet && s->orig_buffer_size && s->buffer_size > s->orig_buffer_size) { if (dst == s->buffer) { - ffio_set_buf_size(s, max_buffer_size); + ffio_set_buf_size(s, s->orig_buffer_size); s->checksum_ptr = dst = s->buffer; } - av_assert0(len >= max_buffer_size); - len = max_buffer_size; + av_assert0(len >= s->orig_buffer_size); + len = s->orig_buffer_size; } if (s->read_packet) @@ -792,6 +793,7 @@ int ffio_set_buf_size(AVIOContext *s, int buf_size) av_free(s->buffer); s->buffer = buffer; + s->orig_buffer_size = s->buffer_size = buf_size; s->buf_ptr = buffer; url_resetbuf(s, s->write_flag ? AVIO_FLAG_WRITE : AVIO_FLAG_READ); |