From 3f49b21b80ed251baa5749b7e6d76d4538488d6c Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Fri, 5 Nov 2021 15:17:20 +0530 Subject: [PATCH] imagefreeze: Only set caps if they do not match current caps Part-of: --- subprojects/gst-plugins-good/gst/imagefreeze/gstimagefreeze.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/subprojects/gst-plugins-good/gst/imagefreeze/gstimagefreeze.c b/subprojects/gst-plugins-good/gst/imagefreeze/gstimagefreeze.c index 7fc5477..a25b6e5 100644 --- a/subprojects/gst-plugins-good/gst/imagefreeze/gstimagefreeze.c +++ b/subprojects/gst-plugins-good/gst/imagefreeze/gstimagefreeze.c @@ -232,7 +232,7 @@ gst_image_freeze_sink_setcaps (GstImageFreeze * self, GstCaps * caps) gboolean ret = FALSE; GstStructure *s; gint fps_n, fps_d; - GstCaps *othercaps, *intersection; + GstCaps *othercaps, *intersection, *pad_current_caps; guint i, n; GstPad *pad; @@ -245,8 +245,12 @@ gst_image_freeze_sink_setcaps (GstImageFreeze * self, GstCaps * caps) if (self->negotiated_framerate) { gst_caps_set_simple (caps, "framerate", GST_TYPE_FRACTION, self->fps_n, self->fps_d, NULL); - GST_DEBUG_OBJECT (pad, "Setting caps %" GST_PTR_FORMAT, caps); - gst_pad_set_caps (self->srcpad, caps); + pad_current_caps = gst_pad_get_current_caps (self->srcpad); + if (pad_current_caps && !gst_caps_is_equal (caps, pad_current_caps)) { + GST_DEBUG_OBJECT (pad, "Setting caps %" GST_PTR_FORMAT, caps); + gst_pad_set_caps (self->srcpad, caps); + } + gst_caps_unref (pad_current_caps); gst_caps_unref (caps); return TRUE; } -- 2.7.4