From c4093e7d872d2daa485029b8b36661411387ef37 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Mon, 16 Jan 2012 23:34:03 +0200 Subject: vd_ffmpeg: explicitly set thread count even if 1 Libav started automatically enabling threaded decoding a while ago. This is not safe, as it means callbacks can suddenly get called from other threads and outside calls to libavcodec. We need to know when threading will be used and disable thread-unsafe callbacks in those cases. Explicitly set thread count to 1 instead of leaving it at 0 (which triggers the autodetection) when we are not requesting more threads; this should make sure that autodetection on libavcodec side will not be used. --- libmpcodecs/vd_ffmpeg.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'libmpcodecs') diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c index bed70543b2..0688aae7cc 100644 --- a/libmpcodecs/vd_ffmpeg.c +++ b/libmpcodecs/vd_ffmpeg.c @@ -315,8 +315,7 @@ static int init(sh_video_t *sh) if (sh->bih) avctx->bits_per_coded_sample = sh->bih->biBitCount; - if (lavc_param->threads > 1) - avctx->thread_count = lavc_param->threads; + avctx->thread_count = lavc_param->threads; /* open it */ if (avcodec_open(avctx, lavc_codec) < 0) { -- cgit v1.2.3