[vlc-commits] Improved default threads count when using automatic mode in avcodec.

Laurent Aimar git at videolan.org
Tue Jan 10 23:29:19 CET 2012


vlc | branch: master | Laurent Aimar <fenrir at videolan.org> | Tue Jan 10 23:26:33 2012 +0100| [87e9c403dece6d0c347d7314402f1919cb36b859] | committer: Laurent Aimar

Improved default threads count when using automatic mode in avcodec.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=87e9c403dece6d0c347d7314402f1919cb36b859
---

 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 1cb9c7a..b30e036 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 > 1 )
+            i_thread_count++;
+    }
     i_thread_count = __MIN( i_thread_count, 16 );
     msg_Dbg( p_dec, "allowing %d thread(s) for decoding", i_thread_count );
     p_sys->p_context->thread_count = i_thread_count;



More information about the vlc-commits mailing list