[FFmpeg-devel] [PATCH] Revert "avcodec/decode: copy the output parameters from the last bsf in the chain back to the AVCodecContext"

James Almer jamrial at gmail.com
Thu Sep 13 18:44:10 EEST 2018

On 9/13/2018 6:50 AM, Timo Rothenpieler wrote:
>> So, what do we do now? Honor the doxy and stop trying to manipulate
>> what's meant to be an user owned pointer/buffer, officially break the
>> API and declare it's meant to be allocated by the user but then
>> ownership is passed to the library during or after the avcodec_open2()
>> call, or just revert this commit and pretend nothing happened?
> Documenting the API break that already happened seems like the least bad
> option right now. Firefox already merged code to work around the crash.
> It already is freed in multiple places, so existing code probably
> already is compatible.
> No solution to this is overly pretty unfortunately.
> Specially as this goes along with likely leaking the extradata pointer,
> as unconditionally freeing it will most definitely cause crashes left
> and right.

Commit fd056029f45a9f6d213d9fce8165632042511d4f is what introduced
avcodec_free_context(), including the unconditional av_free call for
extradata. Assuming that's the first case of the extradata pointer being
manipulated by lavc for a decoder, then the doxy has been pretty much
incorrect for at least four years now.

So i guess you're right, and perhaps we should just change the doxy to
reflect the behavior the library has featured all this time: That the
user needs to allocate it with av_malloc(), but after calling
avcodec_open2() ownership is passed to lavc.

> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

More information about the ffmpeg-devel mailing list