From 56bfb9a7b4c9c91ca7b652f9392bdab715f08a26 Mon Sep 17 00:00:00 2001 From: Michael Tretter Date: Thu, 5 Sep 2024 15:04:33 +0200 Subject: [PATCH] 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: --- .../gst-plugins-bad/sys/uvcgadget/gstuvcsink.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/subprojects/gst-plugins-bad/sys/uvcgadget/gstuvcsink.c b/subprojects/gst-plugins-bad/sys/uvcgadget/gstuvcsink.c index 6c1602acc1..2047d4fedc 100644 --- a/subprojects/gst-plugins-bad/sys/uvcgadget/gstuvcsink.c +++ b/subprojects/gst-plugins-bad/sys/uvcgadget/gstuvcsink.c @@ -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: