[FFmpeg-devel] mutlithreading in ffmpeg?

Frank Barchard fbarchard at google.com
Tue Mar 29 21:41:22 CEST 2011


On Mon, Mar 28, 2011 at 10:50 PM, Reimar Döffinger <Reimar.Doeffinger at gmx.de
> wrote:

> On 29 Mar 2011, at 03:32, Frank Barchard <fbarchard at google.com> wrote:
> > On Sun, Mar 27, 2011 at 2:52 AM, Reimar Döffinger
> > <Reimar.Doeffinger at gmx.de>wrote:
> >
> >> On Sat, Mar 26, 2011 at 12:14:40PM +0100, Michael Niedermayer wrote:
> >>> This patch looks like it would break if libavcodec would be linked
> >>> with an application that itself also used static pthreads
> >>
> >> Not to mention that it will crash if an application dynamically loads
> >> libavcodec and then unloads it before exiting (i.e. the atexit code
> >> will no longer exist when the program exits).
> >>
> > Thats what Chromium does - Each tab is a process that loads
> avcodec-52.dll.
> > Closing a tab unloads the dll.
> > A DLL is really an .exe.  The atexit code runs when the DLL is unloaded.
>
> At least "man atexit" does not specify any such behaviour, are you really
> sure you're not relying on an implementation detail?
>

MSDN documents _onexit better:
http://msdn.microsoft.com/en-us/library/zk17ww08(v=vs.71).aspx


> Actually, are you really sure that you unload the avcodec dll separately
> before exiting the tab process, that seems like a pointless thing to do.
>

Correct.  The process (for each tab) unloads the dll for us.  The chromium
ffmpeg dll loader is here:
http://src.chromium.org/viewvc/chrome/trunk/src/media/base/media_win.cc?content-type=text%2Fplain

We picked up this static pthread patch from here:
http://ffmpeg.arrozcru.org/wiki/images/d/dd/Ffmpeg_r15966_static_pthreads.diff
http://ffmpeg.arrozcru.org/forum/viewtopic.php?f=1&t=1276

Ran another test - ff vp8
>media_bench --flush --stream=video --video-threads=1 tulip2.webm
        FPS:     378.99
>media_bench --flush --stream=video --video-threads=2 tulip2.webm
        FPS:     377.25
just checking :)


More information about the ffmpeg-devel mailing list