From 79a74089d42508743b14abd8adeff6b9024d44e8 Mon Sep 17 00:00:00 2001 From: "Oleksij Rempel (Alexey Fisher)" Date: Tue, 20 Mar 2012 17:32:00 -0300 Subject: [PATCH] wrappercamerabinsrc: avoid reseting caps to the same value 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 | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gst/camerabin2/gstwrappercamerabinsrc.c b/gst/camerabin2/gstwrappercamerabinsrc.c index 03f775f92e..5185789b5a 100644 --- a/gst/camerabin2/gstwrappercamerabinsrc.c +++ b/gst/camerabin2/gstwrappercamerabinsrc.c @@ -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);