summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Dufresne <nicolas.dufresne@collabora.com>2015-07-21 13:14:59 -0400
committerNicolas Dufresne <nicolas.dufresne@collabora.com>2015-07-22 13:29:35 -0400
commitf9aa30674781651a64c39903325bf385c34b75ec (patch)
treef526f55450524463f44fa23766102a996c568724
parent0a50d1be523e88c87dd7ded8bc9cc22eca0f5669 (diff)
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
-rw-r--r--libs/gst/base/gstbasetransform.c18
1 files 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);