OSDN Git Service

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)
committerMark Thompson <sw@jkqxz.net>
Sat, 26 Nov 2016 18:03:05 +0000 (18:03 +0000)
libavutil/hwcontext_vaapi.c

index 1988729..b2e212c 100644 (file)
@@ -388,6 +388,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,