dshowsrcwrapper: Fixed null caps comparison
authorMatthew Bader <matt@hyperlobic.net>
Wed, 3 Dec 2014 21:13:17 +0000 (16:13 -0500)
committerSebastian Dröge <sebastian@centricular.com>
Thu, 4 Dec 2014 17:04:11 +0000 (18:04 +0100)
https://bugzilla.gnome.org/show_bug.cgi?id=741086

sys/dshowsrcwrapper/gstdshowaudiosrc.cpp
sys/dshowsrcwrapper/gstdshowvideosrc.cpp

index d5a77b4..c4d33e5 100644 (file)
@@ -454,12 +454,13 @@ gst_dshowaudiosrc_prepare (GstAudioSrc * asrc, GstAudioRingBufferSpec * spec)
   GstDshowAudioSrc *src = GST_DSHOWAUDIOSRC (asrc);
   GstCaps *current_caps = gst_pad_get_current_caps (GST_BASE_SRC_PAD (asrc));
 
-  if (gst_caps_is_equal (spec->caps, current_caps)) {
+  if (current_caps) {
+    if (gst_caps_is_equal (spec->caps, current_caps)) {
+      gst_caps_unref (current_caps);
+      return TRUE;
+    }
     gst_caps_unref (current_caps);
-    return TRUE;
   }
-  gst_caps_unref (current_caps);
-
   /* In 1.0, prepare() seems to be called in the PLAYING state. Most
      of the time you can't do much on a running graph. */
 
index c254f0c..441dff9 100644 (file)
@@ -578,11 +578,13 @@ gst_dshowvideosrc_set_caps (GstBaseSrc * bsrc, GstCaps * caps)
   GstStructure *s = gst_caps_get_structure (caps, 0);
   GstCaps *current_caps = gst_pad_get_current_caps (GST_BASE_SRC_PAD (bsrc));
 
-  if (gst_caps_is_equal (caps, current_caps)) {
+  if (current_caps) {
+    if (gst_caps_is_equal (caps, current_caps)) {
+      gst_caps_unref (current_caps);
+      return TRUE;
+    }
     gst_caps_unref (current_caps);
-    return TRUE;
   }
-  gst_caps_unref (current_caps);
 
   /* Same remark as in gstdshowaudiosrc. */
   gboolean was_running = src->is_running;