[FFmpeg-devel] Fix for aviobuf.c::fill_buffer

code bythepound codebythepound at gmail.com
Wed Jul 20 18:59:39 EEST 2016

My app seems to hit the av_assert0(len >= s->orig_buffer_size) (line 535 in
my sources) in aviobuf.c::fill_buffer.  FWIW I have registered a custom
AVIOContext that will consistently not fill the entire buffer when the read
callback is called.

The outcome is that 'len' in fill_buffer is decremented with each call
until it is less than s->orig_buffer_size and will assert fail.  It seems
that instead of the assertion failure, the method should be:

if( len >= s->orig_buffer_size )
    len = s->orig_buffer_size
// otherwise, len is < than orig_buffer_size, but is sized correctly to
fill remainder of buffer.

On the next iteration, the previous clause (dst == s->buffer) is executed
and the buffer is reset.  After that, this block is never executed again.

With the above fix in, my app seems to work fine.

Since the fill_buffer code has been the same for many releases of ffmpeg,
I'm wondering how I could be the first to notice it, and if there is
something else I could be doing wrong to cause this?


More information about the ffmpeg-devel mailing list