From 5d78aab81081d157826e0228dc310b4fae9eb8e0 Mon Sep 17 00:00:00 2001 From: Vineeth T M Date: Mon, 23 Nov 2015 15:06:02 +0900 Subject: [PATCH] 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 --- gst/playback/gstdecodebin2.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/gst/playback/gstdecodebin2.c b/gst/playback/gstdecodebin2.c index 73d835da5b..1dfe6a31f7 100644 --- a/gst/playback/gstdecodebin2.c +++ b/gst/playback/gstdecodebin2.c @@ -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); }