[FFmpeg-devel] [PATCH 2/6] Frame-based multithreading framework using pthreads

Reimar Döffinger Reimar.Doeffinger
Sun Feb 6 11:43:44 CET 2011

On Sat, Feb 05, 2011 at 06:55:52PM -0500, Alexander Strange wrote:
> > Also, how would a portable application use this reliably on a system that
> > may or may not have pthreads available and similar things?
> Sorry, what do you mean? If threads aren't available multithreading
> isn't used and it's reliable. If w32threads are used this still
> applies.

I don't think there is any way for an application to know whether
threads are available or not.

> > IMO what would be really good if the following would be possible:
> > - application sets up multithreaded decoding
> > - application figures out if the FFmpeg version+codec combination actually
> > ?supports/will use multithreading
> > - if it does it will disable slices (since it's too complex to handle and might
> > ?also cause speed issues and probably has no cache benefits), if not use
> > ?slices.
> After calling avcodec_open(), check AVCodecContext.active_thread_type.
> It will be 0 if thread_count <= 1.

But what if thread_count is e.g. 10, but the codec does not support threads?
Or it only supports slice multithreading?
Or the codecs supports frame and slice multithreading but it knows that
due to some special feature set in extradata it cannot use either?

More information about the ffmpeg-devel mailing list