[vlc-devel] [PATCH] Avcodec: limit the number of threads automatically selected to 12

Rafaël Carré rafael.carre at gmail.com
Thu Dec 29 05:59:49 CET 2011


Le 2011-12-28 21:08, Jean-Baptiste Kempf a écrit :
> It seems that over 16 doesn't behave well. Reduce it further for safety

What is the problem exactly ?

> ---
>  modules/codec/avcodec/video.c |    4 ++++
>  1 files changed, 4 insertions(+), 0 deletions(-)
> 
> diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
> index 95e64b5..dada16c 100644
> --- a/modules/codec/avcodec/video.c
> +++ b/modules/codec/avcodec/video.c
> @@ -344,7 +344,11 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
>  #ifdef HAVE_AVCODEC_MT
>      int i_thread_count = var_InheritInteger( p_dec, "ffmpeg-threads" );
>      if( i_thread_count <= 0 )
> +    {
>          i_thread_count = vlc_GetCPUCount();
> +        if( i_thread_count >= 12 )
> +            i_thread_count = 12;
> +    }

In any case there should be a comment explaining the limit

>      msg_Dbg( p_dec, "allowing %d thread(s) for decoding", i_thread_count );
>      p_sys->p_context->thread_count = i_thread_count;
>  #endif




More information about the vlc-devel mailing list