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

Måns Rullgård mru
Wed Jun 1 00:52:47 CEST 2005


"Dario Souza" <dario at datscom.com.br> writes:

> 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*.

There should be no need to serialize access to different contexts.

> 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
> process?

Hmm, I can't recall doing simultaneous decoding of several video
stream streams off-hand.  Decoding several audio streams, and
audio+video is more typical usage.

> 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?

Sure, if there's a bug, it should be fixed.  Which are the variables
you are thinking of?

-- 
M?ns Rullg?rd
mru at inprovide.com





More information about the ffmpeg-devel mailing list