playsink: handle NULL cached caps in getcaps

https://bugzilla.gnome.org/show_bug.cgi?id=661262
This commit is contained in:
Vincent Penquerc'h 2011-10-17 18:43:06 +00:00 committed by Sebastian Dröge
parent 3939457b00
commit c08a23169d

View File

@ -357,11 +357,17 @@ gst_play_sink_convert_bin_getcaps (GstPad * pad)
if (peer) { if (peer) {
GstCaps *peer_caps = gst_pad_get_caps_reffed (peer); GstCaps *peer_caps = gst_pad_get_caps_reffed (peer);
gst_object_unref (peer); gst_object_unref (peer);
if (self->converter_caps) {
ret = gst_caps_union (peer_caps, self->converter_caps); ret = gst_caps_union (peer_caps, self->converter_caps);
gst_caps_unref (peer_caps); gst_caps_unref (peer_caps);
} else {
ret = peer_caps;
}
} else { } else {
ret = gst_caps_ref (self->converter_caps); ret = gst_caps_ref (self->converter_caps);
} }
} else {
ret = gst_caps_new_any ();
} }
GST_PLAY_SINK_CONVERT_BIN_UNLOCK (self); GST_PLAY_SINK_CONVERT_BIN_UNLOCK (self);
@ -389,13 +395,17 @@ gst_play_sink_convert_bin_cache_converter_caps (GstPlaySinkConvertBin * self)
self->converter_caps = NULL; self->converter_caps = NULL;
if (!self->conversion_elements) if (!self->conversion_elements) {
GST_WARNING_OBJECT (self, "No conversion elements");
return; return;
}
head = GST_ELEMENT (g_list_first (self->conversion_elements)->data); head = GST_ELEMENT (g_list_first (self->conversion_elements)->data);
pad = gst_element_get_static_pad (head, "sink"); pad = gst_element_get_static_pad (head, "sink");
if (!pad) if (!pad) {
GST_WARNING_OBJECT (self, "No sink pad found");
return; return;
}
self->converter_caps = gst_pad_get_caps_reffed (pad); self->converter_caps = gst_pad_get_caps_reffed (pad);
GST_INFO_OBJECT (self, "Converter caps: %" GST_PTR_FORMAT, GST_INFO_OBJECT (self, "Converter caps: %" GST_PTR_FORMAT,