[vlc-devel] [PATCH 2/2] codec: dav1d: limit automatic frame thread count

Tristan Matthews tmatth at videolan.org
Thu Nov 19 17:34:03 CET 2020


Hi,

On Thu, Nov 19, 2020 at 11:16 AM Marvin Scholz <epirat07 at gmail.com> wrote:
>
> Without this limit, on a processor with many cores it would use
> so many frame threads that it would fail picture pool allocation.
>
> Fix #25190
> ---
>  modules/codec/dav1d.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/modules/codec/dav1d.c b/modules/codec/dav1d.c
> index dcb09213186..8611b0cdfe9 100644
> --- a/modules/codec/dav1d.c
> +++ b/modules/codec/dav1d.c
> @@ -396,7 +396,7 @@ static int OpenDecoder(vlc_object_t *p_this)
>          p_sys->s.n_tile_threads = VLC_CLIP(vlc_GetCPUCount(), 1, 4);
>      p_sys->s.n_frame_threads = var_InheritInteger(p_this, "dav1d-thread-frames");
>      if (p_sys->s.n_frame_threads == 0)
> -        p_sys->s.n_frame_threads = __MAX(1, vlc_GetCPUCount());
> +        p_sys->s.n_frame_threads = VLC_CLIP(vlc_GetCPUCount(), 1, 16);

In other modules we just do __MIN(vlc_GetCPUCount(), 16); since I
believe vlc_GetCPUCount() has to be > 0.

If that's not the case though, those should be updated.

Best,
-t


More information about the vlc-devel mailing list