[FFmpeg-devel] [PATCH] Make ffplay define in the encoder the number of threads *before* to open it

Stefano Sabatini stefano.sabatini-lala
Sat Mar 8 19:25:49 CET 2008


On date Saturday 2008-03-08 18:55:26 +0100, Michael Niedermayer encoded:
> On Sat, Mar 08, 2008 at 06:33:27PM +0100, Stefano Sabatini wrote:
> > Hi,
> > as in $subject.
> > 
> > If threads support is not enabled and threads count is set to a
> > value greater than MAX_THREADS (currently is 8), then encoder is
> > initialized with a value of thread_count equal to 1, then
> > enc->threads_count is set to the value set by the user, finally
> > libavcodec crashes when it tryies to free the first thread beyond
> > MAX_THREADS (this happens when quitting ffplay).
> 
> the command line parsing code should not accept >MAX_THREADS
[...]

I agree, but MAX_THREADS is defined in libavcodec/mpegvideo.h, which
is not public, furthermore the patch implements the correct behaviour
for opening an encoder so I'd like to see it applied.

For what regards the MAX_THREADS declaration we could export it in
libavcodec/avcodec.h, then make opt_threads_count refuse to accept
values greater than MAX_THREADS (same in ffmpeg.c).

Best regards.
-- 
Stefano Sabatini
Linux user number 337176 (see http://counter.li.org)




More information about the ffmpeg-devel mailing list