[FFmpeg-devel] mt fork merged but currently disabled?

Michael Niedermayer michaelni at gmx.at
Sat Mar 26 12:32:57 CET 2011


On Sat, Mar 26, 2011 at 05:31:10AM +0100, Gianluigi Tiesi wrote:
> Hi,
> 
> by looking at libavcodec/pthreads.c
> 
> in ff_thread_init
> 
> I suspect something like:
> 
> avctx->thread_count = thread_count;
> 
> is missing, while instead is there in w32thread.c
> 
> I've tried to add the line, and finally I get two decoding
> threads when calling mplayer with lavdopts=threads=2
> option

no, see commits below:

commit c0b102ca03fe92250f1ce620aec3836f529fc1d6
Author: Alexander Strange <astrange at ithinksw.com>
Date:   Mon Feb 7 21:15:45 2011 -0500

    Deprecate avcodec_thread_init()

    As a side effect of the last commit, avcodec_open() now calls it automatically,
    so there is no longer any need for clients to call it.
    Instead they should set AVCodecContext.thread_count.

    avcodec_thread_free() is deprecated, and will be removed from avcodec.h at the
    next MAJOR libavcodec bump.

    Rename the functions to ff_thread_init/free, since they are now internal.
    Wrappers are provided to maintain API compatibility.

    Signed-off-by: Ronald S. Bultje <rsbultje at gmail.com>

diff --git a/ffplay.c b/ffplay.c
index 157fd7f..170acfd 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -2260,7 +2260,7 @@ static int stream_component_open(VideoState *is, int stream_index)
     avctx->skip_loop_filter= skip_loop_filter;
     avctx->error_recognition= error_recognition;
     avctx->error_concealment= error_concealment;
-    avcodec_thread_init(avctx, thread_count);
+    avctx->thread_count= thread_count;

     set_context_opts(avctx, avcodec_opts[avctx->codec_type], 0, codec);



commit ff1efc524cb3c60f2f746e3b4550bb1a86c65316
Author: Mans Rullgard <mans at mansr.com>
Date:   Wed Mar 2 13:08:15 2011 +0000

    threads: allow thread count of zero

    This moves setting the thread count to a minimum of 1 to
    frame_thread_init(), allowing a value of zero to propagate
    through to the codec if frame threading is not used.  This
    makes auto-threads work in libx264.

    Signed-off-by: Mans Rullgard <mans at mansr.com>
@@ -882,8 +887,6 @@ int ff_thread_init(AVCodecContext *avctx, int thread_count)
         return -1;
     }

-    avctx->thread_count = FFMAX(1, thread_count);
-
     if (avctx->codec) {
         validate_thread_parameters(avctx);



-----------


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The worst form of inequality is to try to make unequal things equal.
-- Aristotle
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20110326/118c5a61/attachment.asc>


More information about the ffmpeg-devel mailing list