decodebin: return incomplete topology if decode chains' cap could not be obtained

When getting caps of the decode chain, in get_topology, the caps are being
checked if fixed or not. But get_topology will be called when the decode is
chain is being exposed and hence it will always be fixed. Hence removing the
check for fixed caps. Removing gst_pad_get_current_caps for the chain->pad, as
get_pad_caps will again call the same api.

And get_topology can return NULL value if currently shutting down the
pipeline, which on being passed to create message will result in assertion
error. Check if topology is valid before using it

https://bugzilla.gnome.org/show_bug.cgi?id=755918
This commit is contained in:
Vineeth T M 2015-11-23 15:06:02 +09:00 committed by Sebastian Dröge
parent 1cb19d1146
commit 5d78aab810

View file

@ -4497,15 +4497,10 @@ gst_decode_chain_get_topology (GstDecodeChain * chain)
}
/* Caps that resulted in this chain */
caps = gst_pad_get_current_caps (chain->pad);
if (!caps) {
caps = get_pad_caps (chain->pad);
if (G_UNLIKELY (!gst_caps_is_fixed (caps))) {
GST_ERROR_OBJECT (chain->pad,
"Couldn't get fixed caps, got %" GST_PTR_FORMAT, caps);
gst_caps_unref (caps);
caps = NULL;
}
caps = get_pad_caps (chain->pad);
if (G_UNLIKELY (!caps)) {
GST_WARNING_OBJECT (chain->pad, "Couldn't get the caps of decode chain");
return u;
}
gst_structure_id_set (u, topology_caps, GST_TYPE_CAPS, caps, NULL);
gst_structure_id_set (u, topology_element_srcpad, GST_TYPE_PAD, chain->pad,
@ -4523,6 +4518,8 @@ gst_decode_bin_post_topology_message (GstDecodeBin * dbin)
s = gst_decode_chain_get_topology (dbin->decode_chain);
if (G_UNLIKELY (s == NULL))
return;
msg = gst_message_new_element (GST_OBJECT (dbin), s);
gst_element_post_message (GST_ELEMENT (dbin), msg);
}