[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 18:33:27 CET 2008

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).

Check it with:
ffplay -threads 1000 FILE.flv
(crashes in libavcodec/mpegvideo.c:MPV_common_end)

With the patch we get:
stefano at geppetto ~> ~/src/ffmpeg/ffplay -threads 1000 FILE.flv
Warning: not compiled with thread support, using thread emulation
[flv @ 0x83fba40]too many threads

then ffplay reproduces the file with no video.

Best regards.
Stefano Sabatini
Linux user number 337176 (see http://counter.li.org)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: make-ffplay-init-threads-num-before-opening-codec-00.patch
Type: text/x-diff
Size: 656 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080308/a004bed1/attachment.patch>

More information about the ffmpeg-devel mailing list