[FFmpeg-devel] [PATCH 2/2] avutil/slicethread: Add a maximum constraint of 16 slice threads

Michael Niedermayer michael at niedermayer.cc
Fri Nov 5 23:00:41 EET 2021


On Fri, Nov 05, 2021 at 08:32:16PM +0800, lance.lmwang at gmail.com wrote:
> From: Limin Wang <lance.lmwang at gmail.com>
> 
> Signed-off-by: Limin Wang <lance.lmwang at gmail.com>
> ---
>  libavutil/slicethread.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavutil/slicethread.c b/libavutil/slicethread.c
> index 867ce32..7b3a106 100644
> --- a/libavutil/slicethread.c
> +++ b/libavutil/slicethread.c
> @@ -104,7 +104,7 @@ int avpriv_slicethread_create(AVSliceThread **pctx, void *priv,
>      if (!nb_threads) {
>          int nb_cpus = av_cpu_count();
>          if (nb_cpus > 1)
> -            nb_threads = nb_cpus + 1;
> +            nb_threads = FFMIN(nb_cpus + 1, 16);

why should the threads be limited ?
why should they be limited at 16 for everyone ?
one mighht be a 2 core cpu one might have 200 cores

i think the commit message should be more verbose describing what the
problem is that this is fixing

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Homeopathy is like voting while filling the ballot out with transparent ink.
Sometimes the outcome one wanted occurs. Rarely its worse than filling out
a ballot properly.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20211105/3cc42d5e/attachment.sig>


More information about the ffmpeg-devel mailing list