wrappercamerabinsrc: avoid reseting caps to the same value
authorOleksij Rempel (Alexey Fisher) <bug-track@fisher-privat.net>
Tue, 20 Mar 2012 20:32:00 +0000 (17:32 -0300)
committerThiago Santos <thiago.sousa.santos@collabora.com>
Tue, 20 Mar 2012 23:11:30 +0000 (20:11 -0300)
Reduces capture latency when the new caps are the same as the old
one, avoiding resetting the source state for a forced renegotiation.

gst/camerabin2/gstwrappercamerabinsrc.c

index 03f775f..5185789 100644 (file)
@@ -153,6 +153,18 @@ gst_wrapper_camera_bin_reset_video_src_caps (GstWrapperCameraBinSrc * self,
 
   GST_DEBUG_OBJECT (self, "Resetting src caps to %" GST_PTR_FORMAT, caps);
   if (self->src_vid_src) {
+    GstCaps *old_caps;
+
+    g_object_get (G_OBJECT (self->src_filter), "caps", &old_caps, NULL);
+    if (gst_caps_is_equal (caps, old_caps)) {
+      GST_DEBUG_OBJECT (self, "old and new caps are same, do not reset it");
+      if (old_caps)
+        gst_caps_unref (old_caps);
+      return;
+    }
+    if (old_caps)
+      gst_caps_unref (old_caps);
+
     clock = gst_element_get_clock (self->src_vid_src);
     base_time = gst_element_get_base_time (self->src_vid_src);