From: Xavier Claessens Date: Tue, 26 May 2020 14:27:35 +0000 (-0400) Subject: v4l2: Do not renegotiate if only framerate changed X-Git-Tag: 1.19.3~509^2~500 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c187684b783378881d9ef94ce8c0d635a74b3a33;p=platform%2Fupstream%2Fgstreamer.git v4l2: Do not renegotiate if only framerate changed Part-of: --- diff --git a/sys/v4l2/gstv4l2videodec.c b/sys/v4l2/gstv4l2videodec.c index 7f5d6fd..5ee628d 100644 --- a/sys/v4l2/gstv4l2videodec.c +++ b/sys/v4l2/gstv4l2videodec.c @@ -221,6 +221,34 @@ gst_v4l2_video_dec_stop (GstVideoDecoder * decoder) } static gboolean +compatible_caps (GstV4l2VideoDec * self, GstCaps * new_caps) +{ + GstCaps *current_caps, *caps1, *caps2; + GstStructure *s; + gboolean ret; + + current_caps = gst_v4l2_object_get_current_caps (self->v4l2output); + if (!current_caps) + return FALSE; + + caps1 = gst_caps_copy (current_caps); + s = gst_caps_get_structure (caps1, 0); + gst_structure_remove_field (s, "framerate"); + + caps2 = gst_caps_copy (new_caps); + s = gst_caps_get_structure (caps2, 0); + gst_structure_remove_field (s, "framerate"); + + ret = gst_caps_is_equal (caps1, caps2); + + gst_caps_unref (caps1); + gst_caps_unref (caps2); + gst_caps_unref (current_caps); + + return ret; +} + +static gboolean gst_v4l2_video_dec_set_format (GstVideoDecoder * decoder, GstVideoCodecState * state) { @@ -231,7 +259,7 @@ gst_v4l2_video_dec_set_format (GstVideoDecoder * decoder, GST_DEBUG_OBJECT (self, "Setting format: %" GST_PTR_FORMAT, state->caps); if (self->input_state) { - if (gst_v4l2_object_caps_equal (self->v4l2output, state->caps)) { + if (compatible_caps (self, state->caps)) { GST_DEBUG_OBJECT (self, "Compatible caps"); goto done; }