summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRomain Picard <romain.picard@oakbits.com>2016-03-15 16:37:33 +0100
committerTim-Philipp Müller <tim@centricular.com>2016-04-06 09:59:04 +0100
commitd1f87286ab539023d7895a7073545fd3612576bc (patch)
tree34f470d216760c5e4917d3b55501dff7181bee68
parent24b7a8fe1876c1ea092375e29990138e4d5f73be (diff)
downloadgstreamer-d1f87286ab539023d7895a7073545fd3612576bc.tar.gz
typefind: Allow caps query in "have-type" signal handlers
If an application calls gst_pad_query_caps from its "have-type" signal handler, then the query fails because typefind->caps has not been set yet. This patch sets typefind->caps in the object method handler, before the signal handlers are called. https://bugzilla.gnome.org/show_bug.cgi?id=763491
-rw-r--r--plugins/elements/gsttypefindelement.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/plugins/elements/gsttypefindelement.c b/plugins/elements/gsttypefindelement.c
index adf32ecb7a..d1fe080024 100644
--- a/plugins/elements/gsttypefindelement.c
+++ b/plugins/elements/gsttypefindelement.c
@@ -203,9 +203,6 @@ gst_type_find_element_have_type (GstTypeFindElement * typefind,
event = gst_event_new_caps (caps);
}
- if (typefind->caps)
- gst_caps_unref (typefind->caps);
- typefind->caps = gst_caps_ref (caps);
GST_OBJECT_UNLOCK (typefind);
gst_pad_push_event (typefind->src, event);
@@ -217,6 +214,15 @@ gst_type_find_element_emit_have_type (GstTypeFindElement * typefind,
{
GstEvent *event;
+ /* Update caps field immediatly so that caps queries and properties can be
+ * honored in all "have-type" signal handlers.
+ */
+ GST_OBJECT_LOCK (typefind);
+ if (typefind->caps)
+ gst_caps_unref (typefind->caps);
+ typefind->caps = gst_caps_ref (caps);
+ GST_OBJECT_UNLOCK (typefind);
+
/* Only store the caps event at this point. We give signal handlers
* the chance to look at the caps before they are sent downstream.
* They are only forwarded downstream later in the default signal