mirror of https://github.com/mpv-player/mpv
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.
This commit is contained in:
parent
16e29bebf0
commit
7131fceb0b
|
@ -379,8 +379,10 @@ static int init(sh_video_t *sh){
|
||||||
if(sh->bih)
|
if(sh->bih)
|
||||||
avctx->bits_per_coded_sample= sh->bih->biBitCount;
|
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);
|
avcodec_thread_init(avctx, lavc_param->threads);
|
||||||
|
}
|
||||||
/* open it */
|
/* open it */
|
||||||
if (avcodec_open(avctx, lavc_codec) < 0) {
|
if (avcodec_open(avctx, lavc_codec) < 0) {
|
||||||
mp_tmsg(MSGT_DECVIDEO, MSGL_ERR, "Could not open codec.\n");
|
mp_tmsg(MSGT_DECVIDEO, MSGL_ERR, "Could not open codec.\n");
|
||||||
|
|
Loading…
Reference in New Issue