[FFmpeg-devel] [PATCH] avcodec thread safety fix
Måns Rullgård
mans
Tue May 12 22:49:49 CEST 2009
Daniel Steinberg <daniel at InstantHarmony.com> writes:
> 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.
Your patch does not solve the problem you describe. How would the
callback get set for the calls from av_find_stream_info()?
--
M?ns Rullg?rd
mans at mansr.com
More information about the ffmpeg-devel
mailing list