[FFmpeg-devel] Threading issue with avcodec_decode_video2 ?

Reimar Döffinger Reimar.Doeffinger at gmx.de
Mon Nov 12 22:44:15 CET 2012


On Mon, Oct 29, 2012 at 10:38:25PM +0100, Hendrik Leppkes wrote:
> On Mon, Oct 29, 2012 at 10:22 PM, Don Moir <donmoir at comcast.net> wrote:
> > In vc1dec.c it calls the init functions and does a little more. The code
> > under return -1; appears to be ok and seems to be happy in either
> > vc1_decode_init or vc1_decode_frame, but "if (ff_msmpeg4_decode_init(avctx)
> > < 0 || ff_vc1_decode_init_alloc_tables(v) < 0)" only seems to be happy in
> > vc1_decode_init or when locked down.
> >
> > Do you have a multi-threaded test case for this kind of thing ?
> 
> I looked over those two functions, and sadly its required to call them
> there, because its possible that width/height of the video are not
> known during the init function, or may even change in case of vc1image
> decoding.

Could you explain how you came to that conclusion?
At least for ff_msmpeg4_decode_init I am not so sure about that.
But even if they need to be called there, I see nothing speaking against
_also_ calling them in the init function, this results in the VLC tables
being initialized there, thus they will no longer be initialized when
calling those functions during decode, thus eliminating the race
condition.


More information about the ffmpeg-devel mailing list