[FFmpeg-devel] MAX_THREADS for ffmpeg-mt mp4

Frank Barchard fbarchard
Thu Sep 24 22:04:33 CEST 2009


On Thu, Sep 24, 2009 at 3:48 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
>
> On Wed, Sep 23, 2009 at 01:43:17PM -0700, Frank Barchard wrote:
> > Attached as a separate patch for just libavcodec/h264.c
> >
> > The other formats that use MAX_THREADS already had a check, so I
> > copied this from dnxhdenc.c
> > This prevents the crash, but is a fatal error:
> > [h264 @ 0x2873030]too many threads
> > [h264 @ 0x2873030]decode_slice_header error
>
> not the right place, it should be in decode_init() or something called
> by it

Michael,
Its not ideal, but thats where dnxhd.c does it.
I considered putting it in avcodec_thread_init, which allows for
graceful failure. ie
if (avcodec_thread_init(codec_context, video_threads) < 0)
   // warning
but avcodec_thread_init is implemented in 4 places:  beosthread,
os2thread, pthread, and w32thread.

Perhaps decode_init() should clamp the video_threads to max, output a
warning, but continue?



More information about the ffmpeg-devel mailing list