[FFmpeg-devel] [PATCH] avcodec thread safety fix
Tue May 12 22:36:19 CEST 2009
Although avcodec_open/avcodec_close are known to have thread-safety
issues (hence the entangled_thread_counter), it is not sufficient in a
multi-threaded environment to simply protect calls to them with a
mutex, because av_find_stream_info() internally calls them as well.
Further, av_find_stream_info() may subsequently block for input, so it
is not a good idea to hold a mutex for the duration of its call.
Attached is a proposed fix that allows clients to specify a locking
routine that, if non-NULL, will be called by avcodec_open() and
avcodec_close(), thereby protecting them from re-entrancy regardless
of the calling source.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2447 bytes
Desc: not available
More information about the ffmpeg-devel