From 7a3316543610e0728272d7b1e6cb873c0c884426 Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Fri, 29 Nov 2013 14:02:52 +0100 Subject: [PATCH] plugins: fix reference leaks of VA display objects. Fix GstElement::set_context() implementation for all plug-in elements to avoid leaking an extra reference to the VA display, thus preventing correct cleanup of VA resources in GStreamer 1.2 builds. --- gst/vaapi/gstvaapidecode.c | 1 + gst/vaapi/gstvaapiencode.c | 1 + gst/vaapi/gstvaapipostproc.c | 1 + gst/vaapi/gstvaapisink.c | 1 + 4 files changed, 4 insertions(+) diff --git a/gst/vaapi/gstvaapidecode.c b/gst/vaapi/gstvaapidecode.c index 6748599..3225a95 100644 --- a/gst/vaapi/gstvaapidecode.c +++ b/gst/vaapi/gstvaapidecode.c @@ -591,6 +591,7 @@ gst_vaapidecode_set_context(GstElement *element, GstContext *context) if (gst_vaapi_video_context_get_display(context, &display)) { GST_INFO_OBJECT(element, "set display %p", display); gst_vaapi_display_replace(&decode->display, display); + gst_vaapi_display_unref(display); } } #endif diff --git a/gst/vaapi/gstvaapiencode.c b/gst/vaapi/gstvaapiencode.c index a6bab13..c3b2f55 100644 --- a/gst/vaapi/gstvaapiencode.c +++ b/gst/vaapi/gstvaapiencode.c @@ -71,6 +71,7 @@ gst_vaapiencode_set_context (GstElement * element, GstContext * context) if (gst_vaapi_video_context_get_display (context, &display)) { GST_INFO_OBJECT (element, "set display %p", display); gst_vaapi_display_replace (&encode->display, display); + gst_vaapi_display_unref (display); } } #else diff --git a/gst/vaapi/gstvaapipostproc.c b/gst/vaapi/gstvaapipostproc.c index 6d2c1de..292405f 100755 --- a/gst/vaapi/gstvaapipostproc.c +++ b/gst/vaapi/gstvaapipostproc.c @@ -264,6 +264,7 @@ gst_vaapipostproc_set_context(GstElement *element, GstContext *context) if (gst_vaapi_video_context_get_display(context, &display)) { GST_INFO_OBJECT(element, "set display %p", display); gst_vaapi_display_replace(&postproc->display, display); + gst_vaapi_display_unref(display); } } #endif diff --git a/gst/vaapi/gstvaapisink.c b/gst/vaapi/gstvaapisink.c index bf2074a..74f584b 100644 --- a/gst/vaapi/gstvaapisink.c +++ b/gst/vaapi/gstvaapisink.c @@ -1351,6 +1351,7 @@ gst_vaapisink_set_context(GstElement *element, GstContext *context) if (gst_vaapi_video_context_get_display(context, &display)) { GST_INFO_OBJECT(element, "set display %p", display); gst_vaapi_display_replace(&sink->display, display); + gst_vaapi_display_unref(display); } } #endif -- 2.7.4