[FFmpeg-devel] init_static_data function: nonsense?

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue Nov 27 20:30:34 CET 2012

We currently have a init_static_data functionality for
codecs which seems to be used by exactly 2 codecs:
x264 and atrac3.
I think this functionality is just nonsense/crap, because
it is called from avcodec_register, which means
1) We actually don't have locking, entangled thread counters etc.
to ensure it is used correctly
2) It means the data is initialized and memory allocated for
it even if we will never use the codec
3) It makes startup/registering slower than necessary
4) All codecs except these two initialize their static data on open()

I'd like to get rid of this because I'd like to add asserts that
the static VLC initialization code is only called from
avcodec_open2 when the locks are held, to avoid issues like the
VC1 decoder aborting in a multithreaded environment reappearing
(once that is actually fixed...).

More information about the ffmpeg-devel mailing list