uvcsink: skip comparison with prev_caps if they are not set

The uvcsink may be put into the READY state to start listening for UVC requests.
Therefore, the UVC host may set a streaming format before the GStreamer pipeline
is started and the uvcsink received a caps event. In this case, prev_caps will
be NULL.

If the EVENT_CAPS has not been received, skip the check if the format needs to
be changed, since the sink will be started with the format selected by the UVC
host, anyway.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7473>
This commit is contained in:
Michael Tretter 2024-09-05 15:04:33 +02:00 committed by GStreamer Marge Bot
parent ab0a985c46
commit f82a716009

View file

@ -624,12 +624,14 @@ gst_uvc_sink_task (gpointer data)
gst_caps_unref (configured_caps);
prev_caps = gst_pad_get_current_caps (self->sinkpad);
if (!gst_caps_is_subset (prev_caps, self->cur_caps)) {
self->caps_changed = TRUE;
GST_DEBUG_OBJECT (self,
"caps changed from %" GST_PTR_FORMAT, prev_caps);
if (prev_caps) {
if (!gst_caps_is_subset (prev_caps, self->cur_caps)) {
self->caps_changed = TRUE;
GST_DEBUG_OBJECT (self,
"caps changed from %" GST_PTR_FORMAT, prev_caps);
}
gst_caps_unref (prev_caps);
}
gst_caps_unref (prev_caps);
}
break;
default: