avdeinterlace: Don't assume that get_current_caps() returns non-NULL caps after has_c...
authorSebastian Dröge <sebastian@centricular.com>
Tue, 23 Feb 2016 16:19:18 +0000 (18:19 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Tue, 23 Feb 2016 16:19:18 +0000 (18:19 +0200)
Remove calls to gst_pad_has_current_caps() which then go on to call
gst_pad_get_current_caps() as the caps can go to NULL in between. Instead just
use gst_pad_get_current_caps() and check for NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=759539

ext/libav/gstavdeinterlace.c

index 1ffcb07..e3cfa8d 100644 (file)
@@ -404,16 +404,15 @@ gst_ffmpegdeinterlace_chain (GstPad * pad, GstObject * parent,
 
   GST_OBJECT_LOCK (deinterlace);
   if (deinterlace->reconfigure) {
+    GstCaps *caps;
+
     if ((gint) deinterlace->new_mode != -1)
       deinterlace->mode = deinterlace->new_mode;
     deinterlace->new_mode = -1;
 
     deinterlace->reconfigure = FALSE;
     GST_OBJECT_UNLOCK (deinterlace);
-    if (gst_pad_has_current_caps (deinterlace->srcpad)) {
-      GstCaps *caps;
-
-      caps = gst_pad_get_current_caps (deinterlace->sinkpad);
+    if ((caps = gst_pad_get_current_caps (deinterlace->srcpad))) {
       gst_ffmpegdeinterlace_sink_setcaps (deinterlace->sinkpad, caps);
       gst_caps_unref (caps);
     }