libs: fix GstVaapiSurfaceProxy destroy notify call site.
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Wed, 20 Nov 2013 14:10:17 +0000 (15:10 +0100)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Thu, 21 Nov 2013 10:08:23 +0000 (11:08 +0100)
The user-defined destroy notify function is meant to be called only when
the surface proxy was fully released, i.e. once it actually released the
VA surface back to the underlying pool.

gst-libs/gst/vaapi/gstvaapisurfaceproxy.c

index f6981038fe1764ccc255b0b99beef0cd539e1093..f9e488a1533918913c8f0d40bbe541b5ed9587a2 100644 (file)
@@ -36,9 +36,6 @@
 static void
 gst_vaapi_surface_proxy_finalize(GstVaapiSurfaceProxy *proxy)
 {
-    if (proxy->destroy_func)
-        proxy->destroy_func(proxy->destroy_data);
-
     if (proxy->surface) {
         if (proxy->pool)
             gst_vaapi_video_pool_put_object(proxy->pool, proxy->surface);
@@ -46,6 +43,10 @@ gst_vaapi_surface_proxy_finalize(GstVaapiSurfaceProxy *proxy)
         proxy->surface = NULL;
     }
     gst_vaapi_video_pool_replace(&proxy->pool, NULL);
+
+    /* Notify the user function that the object is now destroyed */
+    if (proxy->destroy_func)
+        proxy->destroy_func(proxy->destroy_data);
 }
 
 static inline const GstVaapiMiniObjectClass *