h264parse: only update src CAPS when it's necessary
authorMatthieu Bouron <matthieu.bouron@collabora.com>
Tue, 27 Aug 2013 10:27:04 +0000 (11:27 +0100)
committerSebastian Dröge <slomo@circular-chaos.org>
Tue, 27 Aug 2013 13:00:45 +0000 (15:00 +0200)
https://bugzilla.gnome.org/show_bug.cgi?id=705452

gst/videoparsers/gsth264parse.c

index e103bbb8d287c65e776caa9d33a1dab52069443f..47b9c676fb2d49a2a8b951139e2149df2c121686 100644 (file)
@@ -1150,7 +1150,7 @@ static void
 gst_h264_parse_update_src_caps (GstH264Parse * h264parse, GstCaps * caps)
 {
   GstH264SPS *sps;
-  GstCaps *sink_caps;
+  GstCaps *sink_caps, *src_caps;
   gboolean modified = FALSE;
   GstBuffer *buf = NULL;
   GstStructure *s = NULL;
@@ -1323,7 +1323,13 @@ gst_h264_parse_update_src_caps (GstH264Parse * h264parse, GstCaps * caps)
       gst_structure_remove_field (s, "codec_data");
       gst_buffer_replace (&h264parse->codec_data, NULL);
     }
-    gst_pad_set_caps (GST_BASE_PARSE_SRC_PAD (h264parse), caps);
+
+    src_caps = gst_pad_get_current_caps (GST_BASE_PARSE_SRC_PAD (h264parse));
+    if (!(src_caps && gst_caps_is_strictly_equal (src_caps, caps)))
+      gst_pad_set_caps (GST_BASE_PARSE_SRC_PAD (h264parse), caps);
+
+    if (src_caps)
+      gst_caps_unref (src_caps);
     gst_caps_unref (caps);
   }