rtspsrc: Skip PTs with caps incompatible to the global caps
authorSebastian Dröge <sebastian@centricular.com>
Tue, 4 Apr 2023 16:23:14 +0000 (19:23 +0300)
committerTim-Philipp Müller <tim@centricular.com>
Tue, 4 Apr 2023 23:56:05 +0000 (00:56 +0100)
Otherwise empty caps are created while all following code assumes that
the caps will have exactly one structure, and then run into assertions.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4343>

subprojects/gst-plugins-good/gst/rtsp/gstrtspsrc.c

index c431447..bf389f8 100644 (file)
@@ -2301,6 +2301,13 @@ gst_rtspsrc_collect_payloads (GstRTSPSrc * src, const GstSDPMessage * sdp,
     outcaps = gst_caps_intersect (caps, global_caps);
     gst_caps_unref (caps);
 
+    if (gst_caps_is_empty (outcaps)) {
+      GST_WARNING_OBJECT (src,
+          " skipping pt %d with caps conflicting with the global caps", pt);
+      gst_caps_unref (outcaps);
+      continue;
+    }
+
     /* the first pt will be the default */
     if (stream->ptmap->len == 0)
       stream->default_pt = pt;