[Ffmpeg-devel] Random crashes when using libavcodec in different threads

Rich Felker dalias
Mon Jul 25 14:39:09 CEST 2005

On Mon, Jul 25, 2005 at 01:57:56PM +0200, Bernhard Prell wrote:
> Dear ffmpeg-Gurus,
> I'm trying too integrate/use libavcodec in my own program and got it working 
> as long it's running "alone". That means I'm using multiple threads to encode 
> different movies (to *.vob) on a smp system. (I'm _not_ interested in 
> accelerating the encoding of a _single_ movie by using the 
> multi-thread-capabilities of ffmpeg!)
> Problem: My program crashes randomly at the beginning when I'm for example 
> using libav* in two threads. Then one of the threads dies in 
> "ff_estimate_p_frame_motion" and the other was for example in 
> "MPV_common_init_mmx" or "ff_dct_sse2" or "dsputil_init_pix_mmx".

AFAIK you must use locking around calls to initialize codecs, and you
certainly need to for the main lavc init functions. Otherwise, once
you have contexts they should be entirely independent and fully
thread-safe with no locking.


More information about the ffmpeg-devel mailing list