[FFmpeg-devel] [PATCH v3 08/12] lavc/frame_thread_encoder: avoid assigning a whole AVCodecContext

Anton Khirnov anton at khirnov.net
Sun Mar 24 13:36:03 EET 2024


Quoting Andreas Rheinhardt (2024-03-24 12:25:53)
> Anton Khirnov:
> > It is highly unsafe, as AVCodecContext contains many allocated fields.
> > Everything needed by worked threads should be covered by
> > * routing through AVCodecParameters
> > * av_opt_copy()
> > * copying quantisation matrices manually
> > 
> > avcodec_free_context() can now be used for per-thread contexts.
> 
> So now we have to maintain a list of stuff to be copied just to avoid
> this "unsafe" copying. Sounds worse to me.

We have to maintain a list of stuff either way, the difference is that
with my patch forgetting an item may result in some features not
working, while with current code forgetting an item will typically cause
a double free.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list