wrappercamerabinsrc: prevent caps renegotiation loop
authorThiago Santos <thiago.sousa.santos@collabora.com>
Tue, 1 May 2012 16:28:33 +0000 (13:28 -0300)
committerThiago Santos <thiago.sousa.santos@collabora.com>
Tue, 1 May 2012 18:20:49 +0000 (15:20 -0300)
Only set the zoom capsfilter caps when the new caps are different,
preventing a caps renegotiation loop.

gst/camerabin2/gstwrappercamerabinsrc.c

index 0b28109e90796d60a28c848eb4ba41dbfab20354..7d2c795480f6b933b32377ce0f4ec502c9cf2796 100644 (file)
@@ -397,8 +397,14 @@ gst_wrapper_camera_bin_src_caps_cb (GObject * gobject, GParamSpec * pspec,
   gst_base_camera_src_setup_zoom (bcamsrc);
 
   /* Update post-zoom capsfilter */
-  if (self->src_zoom_filter)
-    g_object_set (G_OBJECT (self->src_zoom_filter), "caps", caps, NULL);
+  if (self->src_zoom_filter) {
+    GstCaps *filtercaps;
+
+    g_object_get (G_OBJECT (self->src_zoom_filter), "caps", &filtercaps, NULL);
+    if (!gst_caps_is_equal (filtercaps, caps))
+      g_object_set (G_OBJECT (self->src_zoom_filter), "caps", caps, NULL);
+    gst_caps_unref (filtercaps);
+  }
 
   /* drop our ref on the caps */
   gst_caps_unref (caps);