From bedaa13d7c208c9da44bf5cfe1b0f3e82dacc162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Wed, 27 Sep 2017 18:35:20 +0200 Subject: [PATCH] vaapipostproc: use scoped variable for return value Instead of reusing a parameter variable for the return value of gst_vaapipostproc_transform_caps(), this patch uses the function scoped pointer. Thus, the code is cleaner. https://bugzilla.gnome.org/show_bug.cgi?id=785706 --- gst/vaapi/gstvaapipostproc.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/gst/vaapi/gstvaapipostproc.c b/gst/vaapi/gstvaapipostproc.c index 7da1547e76..427193c5f4 100644 --- a/gst/vaapi/gstvaapipostproc.c +++ b/gst/vaapi/gstvaapipostproc.c @@ -1132,17 +1132,21 @@ gst_vaapipostproc_transform_caps (GstBaseTransform * trans, (direction == GST_PAD_SINK) ? "sink" : "src"); g_mutex_lock (&postproc->postproc_lock); - caps = gst_vaapipostproc_transform_caps_impl (trans, direction); + out_caps = gst_vaapipostproc_transform_caps_impl (trans, direction); g_mutex_unlock (&postproc->postproc_lock); - if (caps && filter) { - out_caps = gst_caps_intersect_full (caps, filter, GST_CAPS_INTERSECT_FIRST); - gst_caps_unref (caps); - caps = out_caps; + + if (out_caps && filter) { + GstCaps *intersection; + + intersection = gst_caps_intersect_full (out_caps, filter, + GST_CAPS_INTERSECT_FIRST); + gst_caps_unref (out_caps); + out_caps = intersection; } - GST_DEBUG_OBJECT (trans, "returning caps: %" GST_PTR_FORMAT, caps); + GST_DEBUG_OBJECT (trans, "returning caps: %" GST_PTR_FORMAT, out_caps); - return caps; + return out_caps; } static GstCaps *