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.
This commit is contained in:
Robert Rosengren 2024-04-10 08:55:41 +02:00 committed by Wim Taymans
parent c534acac46
commit 95127d8a18

View file

@ -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.");