]> git.sesse.net Git - ffmpeg/commitdiff
hwcontext_vaapi: Don't abort on failing to allocate from a fixed-size pool
authorMark Thompson <sw@jkqxz.net>
Fri, 25 Nov 2016 12:36:05 +0000 (12:36 +0000)
committerwm4 <nfxjfg@googlemail.com>
Thu, 2 Mar 2017 10:20:47 +0000 (11:20 +0100)
Cherry-picked from Libav d30719e62de68975cbc7ffd318df03a183037563.

Signed-off-by: wm4 <nfxjfg@googlemail.com>
libavutil/hwcontext_vaapi.c

index 6176bdc880c81dec7cac0b214a8d55f3b1160abc..da15f891300b0f3f05a42a34e884be5756dfc657 100644 (file)
@@ -397,6 +397,10 @@ static AVBufferRef *vaapi_pool_alloc(void *opaque, int size)
     VAStatus vas;
     AVBufferRef *ref;
 
+    if (hwfc->initial_pool_size > 0 &&
+        avfc->nb_surfaces >= hwfc->initial_pool_size)
+        return NULL;
+
     vas = vaCreateSurfaces(hwctx->display, ctx->rt_format,
                            hwfc->width, hwfc->height,
                            &surface_id, 1,