[FFmpeg-devel] [PATCH]Fix possible crash with -threads 0

Alexander Strange astrange
Fri Nov 26 11:15:29 CET 2010


On Nov 25, 2010, at 12:48 PM, Fran?ois Revol wrote:

> 
> Le 25 nov. 2010 ? 17:34, Michael Niedermayer a ?crit :
> 
>> On Tue, Nov 23, 2010 at 10:55:18PM +0100, Carl Eugen Hoyos wrote:
>>> Hi!
>>> 
>>> Attached patch seems to fix a crash for some users (see issue 2376) - untested 
>>> on Windows.
>>> 
>>> Please comment, Carl Eugen
>> 
>> threads=0 means autodetect the number of threads/cpus.
>> I think this should be implemented, shouldnt be that hard. Such implementation
>> will fix this bug as a sideeffect
> 
> Solaris has some extra sysconf() values:
> http://docs.sun.com/app/docs/doc/816-5168/sysconf-3c?l=en&n=1&a=view
> 
> _SC_NPROCESSORS_MAX
> _SC_NPROCESSORS_CONF
> _SC_NPROCESSORS_ONLN
> 
> I first thought they were standardized and added them to Haiku but it seems not, it's not mentioned on the opengroup pages.
> 
> Google came up with:
> http://www.virtualbox.org/svn/vbox/trunk/src/VBox/Runtime/r3/posix/RTMpGetCount-posix.cpp
> 
> Which answsers the question for Solaris, Haiku and BSD :)

The difficulty isn't in finding the number of CPUs but in deciding how to allocate threads.

For a normal encode ffmpeg opens four codecs (audio/video decoder/encoder), and all of them could somehow benefit from multiple threads. Since there aren't multithreaded audio codecs yet, maybe giving all the extra threads to the video encoder is best.

> 
> Fran?ois.
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at mplayerhq.hu
> https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-devel




More information about the ffmpeg-devel mailing list