From 0634dc768de6e6e9109f2e782253061ba41a807e Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Wed, 14 Dec 2011 14:13:58 +0100 Subject: [PATCH] surface: fix associate subpicture to not report deassociation errors. --- gst-libs/gst/vaapi/gstvaapisurface.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/gst-libs/gst/vaapi/gstvaapisurface.c b/gst-libs/gst/vaapi/gstvaapisurface.c index 18fd414a35..57eab42f8b 100644 --- a/gst-libs/gst/vaapi/gstvaapisurface.c +++ b/gst-libs/gst/vaapi/gstvaapisurface.c @@ -648,15 +648,19 @@ gst_vaapi_surface_associate_subpicture( g_return_val_if_fail(GST_VAAPI_IS_SURFACE(surface), FALSE); g_return_val_if_fail(GST_VAAPI_IS_SUBPICTURE(subpicture), FALSE); - if (!gst_vaapi_surface_deassociate_subpicture(surface, subpicture)) - return FALSE; - if (!surface->priv->subpictures) { surface->priv->subpictures = g_ptr_array_new(); if (!surface->priv->subpictures) return FALSE; } + if (g_ptr_array_remove_fast(surface->priv->subpictures, subpicture)) { + success = _gst_vaapi_surface_deassociate_subpicture(surface, subpicture); + g_object_unref(subpicture); + if (!success) + return FALSE; + } + success = _gst_vaapi_surface_associate_subpicture( surface, subpicture,