[Ffmpeg-devel] Parallel mpeg4/h264 decoding in same process

Dario Souza dario
Wed Jun 1 00:45:20 CEST 2005

I have noticed that when trying to do parallel decoding with MPEG4 decoder
(meaning simultaneous avcodec_decode_video calls, serialized by a global
mutex), video decoding corrupts the image.
Note that I am not talking about using the same codec context of course.
I mean different streams using different AVCodecContext*.

After looking at the code, I could see that (although AVCodecContext holds
the priv member with the codec specific context that *should* in thesis
store the codec state), some static variables are being used and that may
hold state during the decode process.
If so, even if I serialize all the decoder operations, one stream's
operation would corrupt other's state. Note that it wouldn't happen if codec
code accessed only the data that's in the codec specific
AVCodecContext::priv data (H264Context for instance).

My question is:

1) Has anyone succeeded in decoding simultaneous streams in the same
2) If I move the static variables that I suspect to be shared among the
decoding operations, is there a chance to patch it into repository?


Dario Andrade
Executive Director
Mobile +55.21.9453.5005
Office +55.21.2141.9525

More information about the ffmpeg-devel mailing list