From 7d26f65e12b72a644c9f891c9c2d9bebe56ee244 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fran=C3=A7ois=20Cartegnie?= Date: Tue, 24 Sep 2024 18:43:08 +0700 Subject: [PATCH] codec: x265: handle X265_MAX_FRAME_THREADS on newer CPU libx265 will bail out when hitting the limit x265 [error]: frameNumThreads (--frame-threads) must be [0 .. X265_MAX_FRAME_THREADS) (cherry picked from commit bbd294d1e46b86653873ec88d49e9a15cbaae68f) Gbp-Pq: Name 0076-codec-x265-handle-X265_MAX_FRAME_THREADS-on-newer-CP.patch --- modules/codec/x265.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/modules/codec/x265.c b/modules/codec/x265.c index 5585f2cb..2943ea6e 100644 --- a/modules/codec/x265.c +++ b/modules/codec/x265.c @@ -36,6 +36,10 @@ #include +#ifndef X265_MAX_FRAME_THREADS +# define X265_MAX_FRAME_THREADS 16 +#endif + /***************************************************************************** * Module descriptor *****************************************************************************/ @@ -156,6 +160,8 @@ static int Open (vlc_object_t *p_this) x265_param_default(param); param->frameNumThreads = vlc_GetCPUCount(); + if(param->frameNumThreads > X265_MAX_FRAME_THREADS) + param->frameNumThreads = X265_MAX_FRAME_THREADS; param->bEnableWavefront = 0; // buggy in x265, use frame threading for now param->maxCUSize = 16; /* use smaller macroblock */ -- 2.30.2