gst: Handle gst_pad_get_current_caps() returning NULL gracefully

This commit is contained in:
Sebastian Dröge 2016-02-23 18:27:47 +02:00
parent 9b2e1f9f36
commit 49f4631909
4 changed files with 12 additions and 4 deletions

View file

@ -479,6 +479,9 @@ gst_dvdec_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
GstCaps *caps;
caps = gst_pad_get_current_caps (dvdec->srcpad);
if (!caps)
goto not_negotiated;
gst_dvdec_negotiate_pool (dvdec, caps, &dvdec->vinfo);
gst_caps_unref (caps);
}

View file

@ -228,6 +228,8 @@ gst_gdk_pixbuf_dec_setup_pool (GstGdkPixbufDec * filter, GstVideoInfo * info)
guint size, min, max;
target = gst_pad_get_current_caps (filter->srcpad);
if (!target)
return FALSE;
/* try to get a bufferpool now */
/* find a pool for the negotiated caps now */

View file

@ -1546,8 +1546,9 @@ restart:
/* setcaps on sink and src pads */
sinkcaps = gst_pad_get_current_caps (self->sinkpad);
if (!gst_deinterlace_setcaps (self, self->sinkpad, sinkcaps)) {
gst_caps_unref (sinkcaps);
if (!sinkcaps || !gst_deinterlace_setcaps (self, self->sinkpad, sinkcaps)) {
if (sinkcaps)
gst_caps_unref (sinkcaps);
return GST_FLOW_NOT_NEGOTIATED;
}

View file

@ -559,8 +559,10 @@ input_formats_do_not_match:
GST_ELEMENT_ERROR (smpte, CORE, NEGOTIATION, (NULL),
("input formats don't match: %" GST_PTR_FORMAT " vs. %" GST_PTR_FORMAT,
caps1, caps2));
gst_caps_unref (caps1);
gst_caps_unref (caps2);
if (caps1)
gst_caps_unref (caps1);
if (caps2)
gst_caps_unref (caps2);
return GST_FLOW_ERROR;
}
}