From e587ce36787d2519a774d27465d71b2272c9c6c4 Mon Sep 17 00:00:00 2001
From: Laurent Aimar <fenrir@videolan.org>
Date: Tue, 10 Jan 2012 23:10:48 +0100
Subject: [PATCH] Clip number of thread to 16 when using threaded decoding in
 avcodec.

It workarounds an avcodec issue.
---
 modules/codec/avcodec/video.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/modules/codec/avcodec/video.c b/modules/codec/avcodec/video.c
index c422e8ea8467..1cb9c7a689c2 100644
--- a/modules/codec/avcodec/video.c
+++ b/modules/codec/avcodec/video.c
@@ -345,6 +345,7 @@ int InitVideoDec( decoder_t *p_dec, AVCodecContext *p_context,
     int i_thread_count = var_InheritInteger( p_dec, "ffmpeg-threads" );
     if( i_thread_count <= 0 )
         i_thread_count = vlc_GetCPUCount();
+    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;
 #endif
-- 
GitLab