From 1a4b68322563234c689e3fc6a5e1bfd93c388bc0 Mon Sep 17 00:00:00 2001 From: Jan Schmidt Date: Fri, 24 Jan 2025 18:03:10 +1100 Subject: [PATCH] onvif-media: Error for streams that have EMPTY/ANY caps Don't silently fail to put a stream in the SDP if the caps are empty or ANY Part-of: --- .../gst-rtsp-server/gst/rtsp-server/rtsp-onvif-media.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/subprojects/gst-rtsp-server/gst/rtsp-server/rtsp-onvif-media.c b/subprojects/gst-rtsp-server/gst/rtsp-server/rtsp-onvif-media.c index e5cd411940..a9354d0b3a 100644 --- a/subprojects/gst-rtsp-server/gst/rtsp-server/rtsp-onvif-media.c +++ b/subprojects/gst-rtsp-server/gst/rtsp-server/rtsp-onvif-media.c @@ -111,6 +111,13 @@ gst_rtsp_onvif_media_setup_sdp (GstRTSPMedia * media, GstSDPMessage * sdp, } n_caps = gst_caps_get_size (caps); + if (n_caps == 0) { + GST_ERROR ("media caps for stream %p are %" GST_PTR_FORMAT, stream, caps); + res = FALSE; + gst_caps_unref (caps); + break; + } + for (j = 0; res && j < n_caps; j++) { GstStructure *s = gst_caps_get_structure (caps, j); GstCaps *media_caps = gst_caps_new_full (gst_structure_copy (s), NULL);