webrtc: Fixes for matching pads to unassociated transceivers

Fix an inverted condition when checking if sink pad caps match
the codec-preference of an unassociated transceiver, and
fix a condition check for transceiver media kind to
avoid matching sinkpad requests where caps aren't provided
against unassociated transceivers where the caps might
not match later.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7237>
This commit is contained in:
Jan Schmidt 2024-07-24 20:59:51 +10:00 committed by GStreamer Marge Bot
parent 87a7a7567f
commit 09d870a39c

View file

@ -8357,9 +8357,9 @@ gst_webrtc_bin_request_new_pad (GstElement * element, GstPadTemplate * templ,
GstWebRTCBinPad *pad2; GstWebRTCBinPad *pad2;
gboolean has_matching_caps; gboolean has_matching_caps;
/* Ignore transceivers with a non-matching kind */ /* Ignore transceivers with a non-matching kind or where we don't know the kind we want */
if (tmptrans->kind != GST_WEBRTC_KIND_UNKNOWN && if (tmptrans->kind != GST_WEBRTC_KIND_UNKNOWN &&
kind != GST_WEBRTC_KIND_UNKNOWN && tmptrans->kind != kind) (kind == GST_WEBRTC_KIND_UNKNOWN || tmptrans->kind != kind))
continue; continue;
/* Ignore stopped transmitters */ /* Ignore stopped transmitters */
@ -8381,7 +8381,7 @@ gst_webrtc_bin_request_new_pad (GstElement * element, GstPadTemplate * templ,
GST_OBJECT_LOCK (tmptrans); GST_OBJECT_LOCK (tmptrans);
has_matching_caps = (caps && tmptrans->codec_preferences && has_matching_caps = (caps && tmptrans->codec_preferences &&
!gst_caps_can_intersect (caps, tmptrans->codec_preferences)); gst_caps_can_intersect (caps, tmptrans->codec_preferences));
GST_OBJECT_UNLOCK (tmptrans); GST_OBJECT_UNLOCK (tmptrans);
/* Ignore transceivers with non-matching caps */ /* Ignore transceivers with non-matching caps */
if (!has_matching_caps) if (!has_matching_caps)