[FFmpeg-devel] [PATCH] lavf/movenc: Use a dynamic buffer when writing the mfra box

Derek Buitenhuis derek.buitenhuis at gmail.com
Tue Jun 23 19:52:12 EEST 2020


On 23/06/2020 16:59, Andreas Rheinhardt wrote:
> Use avio_get_dyn_buf in combination with ffio_free_dyn_buf. That way you
> save an allocation+copy in case the data fits into the dynamic buffer's
> write buffer (it has a size of 1024 bytes; I don't know how common it is
> for this box to be smaller).

OK, will do and send a v2.

>> +    if (ret < 0)
>> +        return ret;
> Furthermore, avio_close_dyn_buf doesn't even provide a way to check for
> errors; e.g. it does not allow you to distinguish between truncation
> errors and non-truncation errors (due to returning an int, the internal
> buffer is capped to INT_MAX). avio_close_dyn_buf actually may not return
> anything negative (it is documented to just return the length of the
> byte buffer), yet due to a bug it returns -AV_INPUT_BUFFER_PADDING_SIZE
> on allocation error.

I guess my question would be: Why do we leave the public AVIO API with this
function we try to even avoid internally?

- Derek



More information about the ffmpeg-devel mailing list