[vlc-devel] [VLC 3.x] codec: dav1d: limit automatic frame thread count

Rémi Denis-Courmont remi at remlab.net
Wed Dec 2 13:08:04 CET 2020


Hi,

Don't use the crappy (and name-unspaced) __MAX, this expands wrong. There's even a nanoscopic race here if the process affinity is changed concurrently.

Le 2 décembre 2020 13:09:08 GMT+02:00, Marvin Scholz <epirat07 at gmail.com> a écrit :
>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 3e44d524ed..9e7f233d1a 100644
>--- a/modules/codec/dav1d.c
>+++ b/modules/codec/dav1d.c
>@@ -287,7 +287,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 = __MIN(vlc_GetCPUCount(), 16);
>     p_sys->s.allocator.cookie = dec;
>     p_sys->s.allocator.alloc_picture_callback = NewPicture;
>     p_sys->s.allocator.release_picture_callback = FreePicture;
>-- 
>2.24.3 (Apple Git-128)
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel

-- 
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20201202/92624ccd/attachment.html>


More information about the vlc-devel mailing list