From 95127d8a18496da38934907866a32d3f28f8cbb3 Mon Sep 17 00:00:00 2001 From: Robert Rosengren Date: Wed, 10 Apr 2024 08:55:41 +0200 Subject: [PATCH] gst/src: fix crash when current_caps is NULL gst_pad_get_current_caps may return NULL and passing that into gst_caps_is_equal may result in fatal critical log due to the "g_return_val_if_fail (GST_IS_CAPS (caps1)" check. Fix by checking for NULL to avoid this. --- src/gst/gstpipewiresrc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gst/gstpipewiresrc.c b/src/gst/gstpipewiresrc.c index 4ae881106..4ef48cdcc 100644 --- a/src/gst/gstpipewiresrc.c +++ b/src/gst/gstpipewiresrc.c @@ -871,7 +871,7 @@ gst_pipewire_src_negotiate (GstBaseSrc * basesrc) current_caps = gst_pad_get_current_caps (GST_BASE_SRC_PAD (pwsrc)); preferred_new_caps = gst_caps_copy_nth (possible_caps, 0); - if (gst_caps_is_equal (current_caps, preferred_new_caps)) { + if (current_caps && gst_caps_is_equal (current_caps, preferred_new_caps)) { GST_DEBUG_OBJECT (pwsrc, "Stream running and new caps equal current ones. " "Skipping renegotiation.");