[vlc-commits] Improved default threads count when using automatic mode in avcodec.
Laurent Aimar
git at videolan.org
Wed Jan 11 16:13:45 CET 2012
vlc/vlc-1.2 | branch: master | Laurent Aimar <fenrir at videolan.org> | Tue Jan 10 23:26:33 2012 +0100| [04fc5ff697764e7ce3109a1def38bccfe38c1023] | committer: Jean-Baptiste Kempf
Improved default threads count when using automatic mode in avcodec.
(cherry picked from commit 87e9c403dece6d0c347d7314402f1919cb36b859)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.2.git/?a=commit;h=04fc5ff697764e7ce3109a1def38bccfe38c1023
---
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 e40bac7..b0c6a5b 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -336,7 +336,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