From 7131fceb0b80c462604e65fe1869db6e14791b4e Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Tue, 29 Mar 2011 18:54:33 +0300 Subject: [PATCH] vd_ffmpeg: fix thread count setting with latest ffmpeg-mt Recent ffmpeg-mt versions changed the API for setting the number of decoding threads to use (I'm not sure whether dropping backwards compatibility was intentional or not). As a result only one thread was used. Make the thread setting compatible with the new API to restore proper multithreaded decoding. --- libmpcodecs/vd_ffmpeg.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c index d56a63ea59..2424dda95b 100644 --- a/libmpcodecs/vd_ffmpeg.c +++ b/libmpcodecs/vd_ffmpeg.c @@ -379,8 +379,10 @@ static int init(sh_video_t *sh){ if(sh->bih) avctx->bits_per_coded_sample= sh->bih->biBitCount; - if(lavc_param->threads > 1) + if(lavc_param->threads > 1) { + avctx->thread_count = lavc_param->threads; avcodec_thread_init(avctx, lavc_param->threads); + } /* open it */ if (avcodec_open(avctx, lavc_codec) < 0) { mp_tmsg(MSGT_DECVIDEO, MSGL_ERR, "Could not open codec.\n");