mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 00:36:51 +00:00
v4l2: Do not renegotiate if only framerate changed
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/602>
This commit is contained in:
parent
c194390ce9
commit
c187684b78
1 changed files with 29 additions and 1 deletions
|
@ -220,6 +220,34 @@ gst_v4l2_video_dec_stop (GstVideoDecoder * decoder)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue