mirror of
https://github.com/mpv-player/mpv
synced 2025-02-18 05:37:04 +00: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:
parent
6c57eeb7ad
commit
c4093e7d87
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user