From 399875ee86ac7fa2c581e94d154d5ba2b9a7e2d5 Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Tue, 31 Jan 2012 11:26:37 +0100 Subject: [PATCH] decoder: fix memory leak of VA objects on exit. On sequence end, if the last decoded picture is not output for rendering, then the proxy surface is not created. In this case, the original surface must be released explicitly to the context. --- gst-libs/gst/vaapi/gstvaapidecoder_objects.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_objects.c b/gst-libs/gst/vaapi/gstvaapidecoder_objects.c index 968f86bf29..bc5a4e30eb 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_objects.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_objects.c @@ -75,7 +75,10 @@ gst_vaapi_picture_destroy(GstVaapiPicture *picture) g_object_unref(picture->proxy); picture->proxy = NULL; } - + else if (picture->surface) { + /* Explicitly release any surface that was not bound to a proxy */ + gst_vaapi_context_put_surface(GET_CONTEXT(picture), picture->surface); + } picture->surface_id = VA_INVALID_ID; picture->surface = NULL;