[FFmpeg-devel] mutlithreading in ffmpeg?
Reimar.Doeffinger at gmx.de
Tue Mar 29 22:03:12 CEST 2011
On Tue, Mar 29, 2011 at 12:41:22PM -0700, Frank Barchard wrote:
> 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:
Yes, that is better. However for a DLL the nicer way is to implement
DllInitialize and DllUnload functions.
> > 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:
Yes, that won't show the issue, it will only should when someone explicitly unloads
the DLL after having used it. It would then crash at exit, at least it should.
I have some doubts whether this is at all necessary.
> 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 :)
Hm, wasn't it Theora you asked about at the start of the thread?
VP8 doesn't use threading so far, I think I'm not aware of anyone
working on it actually?
More information about the ffmpeg-devel