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

Jean-Baptiste Kempf jb at videolan.org
Thu Dec 29 03:08:01 CET 2011


It seems that over 16 doesn't behave well. Reduce it further for safety
---
 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;
+    }
     msg_Dbg( p_dec, "allowing %d thread(s) for decoding", i_thread_count );
     p_sys->p_context->thread_count = i_thread_count;
 #endif
-- 
1.7.8.rc3




More information about the vlc-devel mailing list