surface: destroy derived image

If gst_vaapi_image_new_with_image() fails, the created derived image should be
destroyed, otherwise the surface cannot be processed because is being used.

https://bugzilla.gnome.org/show_bug.cgi?id=764607
This commit is contained in:
Víctor Manuel Jáquez Leal 2016-04-07 18:03:42 +02:00
parent 506c9e2b5b
commit bb0b8ce7ab

View file

@ -624,6 +624,7 @@ gst_vaapi_surface_derive_image (GstVaapiSurface * surface)
GstVaapiDisplay *display;
VAImage va_image;
VAStatus status;
GstVaapiImage *image;
g_return_val_if_fail (surface != NULL, NULL);
@ -640,7 +641,10 @@ gst_vaapi_surface_derive_image (GstVaapiSurface * surface)
if (va_image.image_id == VA_INVALID_ID || va_image.buf == VA_INVALID_ID)
return NULL;
return gst_vaapi_image_new_with_image (display, &va_image);
image = gst_vaapi_image_new_with_image (display, &va_image);
if (!image)
vaDestroyImage (GST_VAAPI_DISPLAY_VADISPLAY (display), va_image.image_id);
return image;
}
/**