From f9aa30674781651a64c39903325bf385c34b75ec Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Tue, 21 Jul 2015 13:14:59 -0400 Subject: basetransform: Avoid increasing query reference gst_query_find_allocation_meta() requires the query to be writable to work. This patch ensure avoids taking a reference on the query, so we can now check if a certain allocation meta is present. https://bugzilla.gnome.org/show_bug.cgi?id=752661 --- libs/gst/base/gstbasetransform.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/libs/gst/base/gstbasetransform.c b/libs/gst/base/gstbasetransform.c index 21773440e..ecf53455d 100644 --- a/libs/gst/base/gstbasetransform.c +++ b/libs/gst/base/gstbasetransform.c @@ -1503,8 +1503,10 @@ gst_base_transform_default_query (GstBaseTransform * trans, GST_OBJECT_UNLOCK (trans); goto done; } - if ((decide_query = trans->priv->query)) - gst_query_ref (decide_query); + + decide_query = trans->priv->query; + trans->priv->query = NULL; + GST_OBJECT_UNLOCK (trans); GST_DEBUG_OBJECT (trans, @@ -1517,8 +1519,16 @@ gst_base_transform_default_query (GstBaseTransform * trans, else ret = FALSE; - if (decide_query) - gst_query_unref (decide_query); + if (decide_query) { + GST_OBJECT_LOCK (trans); + + if (trans->priv->query == NULL) + trans->priv->query = decide_query; + else + gst_query_unref (decide_query); + + GST_OBJECT_UNLOCK (trans); + } GST_DEBUG_OBJECT (trans, "ALLOCATION ret %d, %" GST_PTR_FORMAT, ret, query); -- cgit v1.2.3