[FFmpeg-devel] init_static_data function: nonsense?

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


On Tue, Nov 27, 2012 at 08:30:34PM +0100, Reimar Döffinger wrote:
> Hello,
> 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...).

Sorry, I realize for the kind of ugly hack libx264 uses this for it
might actually be necessary.
I'll send a patch to remove it from atrac3 though.


More information about the ffmpeg-devel mailing list