[vlc-commits] va_surface: hold a reference on the va_pool for each surface in flight

Steve Lhomme git at videolan.org
Fri Oct 18 16:47:39 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Fri Oct 18 16:14:58 2019 +0200| [96cabf22cbd1d67716d2ce0324f7b49f6ca35b63] | committer: Steve Lhomme

va_surface: hold a reference on the va_pool for each surface in flight

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=96cabf22cbd1d67716d2ce0324f7b49f6ca35b63
---

 modules/codec/avcodec/va_surface.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/codec/avcodec/va_surface.c b/modules/codec/avcodec/va_surface.c
index bf5e4a61e2..411d85fa96 100644
--- a/modules/codec/avcodec/va_surface.c
+++ b/modules/codec/avcodec/va_surface.c
@@ -57,7 +57,7 @@ struct va_pool_t
 
     struct va_pool_cfg callbacks;
 
-    atomic_uintptr_t  poolrefs;
+    atomic_uintptr_t  poolrefs; // 1 ref for the pool creator, 1 ref per surface alive
 };
 
 static void va_pool_AddRef(va_pool_t *va_pool)
@@ -119,6 +119,7 @@ done:
         for (unsigned i = 0; i < va_pool->surface_count; i++) {
             vlc_va_surface_t *surface = &va_pool->surface[i];
             atomic_init(&surface->refcount, 1);
+            va_pool_AddRef(va_pool);
             surface->index = i;
             surface->va_pool = va_pool;
         }
@@ -174,7 +175,7 @@ void va_surface_Release(vlc_va_surface_t *surface)
     if (atomic_fetch_sub(&surface->refcount, 1) != 1)
         return;
 
-    // TODO release more resources
+    va_pool_Release(surface->va_pool);
 }
 
 unsigned va_surface_GetIndex(vlc_va_surface_t *surface)
@@ -210,4 +211,3 @@ va_pool_t * va_pool_Create(vlc_va_t *va, const struct va_pool_cfg *cbs)
 
     return va_pool;
 }
-



More information about the vlc-commits mailing list