diff options
author | Sebastian Dröge <sebastian@centricular.com> | 2016-02-23 18:27:47 +0200 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2016-04-06 11:25:58 +0100 |
commit | 745f3ade6f75115c38f42cbb48a68e12d12476cb (patch) | |
tree | 96521bc0e349d89754368e9ad116d57aad01a454 | |
parent | f1a3edf135aa0542f225dcb6edbd0d3697115392 (diff) | |
download | gstreamer-plugins-good-745f3ade6f75115c38f42cbb48a68e12d12476cb.tar.gz |
gst: Handle gst_pad_get_current_caps() returning NULL gracefully
-rw-r--r-- | ext/dv/gstdvdec.c | 3 | ||||
-rw-r--r-- | ext/gdk_pixbuf/gstgdkpixbufdec.c | 2 | ||||
-rw-r--r-- | gst/deinterlace/gstdeinterlace.c | 7 | ||||
-rw-r--r-- | gst/smpte/gstsmpte.c | 6 |
4 files changed, 15 insertions, 3 deletions
diff --git a/ext/dv/gstdvdec.c b/ext/dv/gstdvdec.c index 4fd01c9a2..89911d70c 100644 --- a/ext/dv/gstdvdec.c +++ b/ext/dv/gstdvdec.c @@ -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); } diff --git a/ext/gdk_pixbuf/gstgdkpixbufdec.c b/ext/gdk_pixbuf/gstgdkpixbufdec.c index 02e780ce0..2f41227cd 100644 --- a/ext/gdk_pixbuf/gstgdkpixbufdec.c +++ b/ext/gdk_pixbuf/gstgdkpixbufdec.c @@ -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 */ diff --git a/gst/deinterlace/gstdeinterlace.c b/gst/deinterlace/gstdeinterlace.c index 0c46a4229..a327ecdb9 100644 --- a/gst/deinterlace/gstdeinterlace.c +++ b/gst/deinterlace/gstdeinterlace.c @@ -1563,7 +1563,12 @@ restart: /* setcaps on sink and src pads */ sinkcaps = gst_pad_get_current_caps (self->sinkpad); - gst_deinterlace_setcaps (self, self->sinkpad, sinkcaps); // FIXME + if (!sinkcaps || !gst_deinterlace_setcaps (self, self->sinkpad, sinkcaps)) { + if (sinkcaps) + gst_caps_unref (sinkcaps); + return GST_FLOW_NOT_NEGOTIATED; + } + gst_caps_unref (sinkcaps); if (flush_one && self->drop_orphans) { diff --git a/gst/smpte/gstsmpte.c b/gst/smpte/gstsmpte.c index 696a1b4cd..f207f060c 100644 --- a/gst/smpte/gstsmpte.c +++ b/gst/smpte/gstsmpte.c @@ -568,8 +568,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; } } |