0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 20:03:10 +02:00

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.
This commit is contained in:
Uoti Urpala 2012-01-16 23:34:03 +02:00
parent 6c57eeb7ad
commit c4093e7d87

View File

@ -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) {