From 329b2d3a6ad73af1fa4a4ab9f2d80d20182b5d38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Sat, 6 Jul 2019 00:58:47 +0300 Subject: [PATCH] webrtcbin: Don't assert if an SDP media can't be converted to caps Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/1008 --- ext/webrtc/gstwebrtcbin.c | 9 +++++++++ ext/webrtc/utils.c | 2 ++ 2 files changed, 11 insertions(+) diff --git a/ext/webrtc/gstwebrtcbin.c b/ext/webrtc/gstwebrtcbin.c index d33d79331c..337384c33a 100644 --- a/ext/webrtc/gstwebrtcbin.c +++ b/ext/webrtc/gstwebrtcbin.c @@ -2935,6 +2935,15 @@ _create_answer_task (GstWebRTCBin * webrtc, const GstStructure * options) answer_dir = GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_RECVONLY; answer_caps = gst_caps_ref (offer_caps); } + + if (gst_caps_is_empty (answer_caps)) { + GST_WARNING_OBJECT (webrtc, "Could not create caps for media"); + if (rtp_trans) + gst_object_unref (rtp_trans); + gst_caps_unref (answer_caps); + goto rejected; + } + seen_transceivers = g_list_prepend (seen_transceivers, rtp_trans); if (!rtp_trans) { diff --git a/ext/webrtc/utils.c b/ext/webrtc/utils.c index cb436416c6..044d583220 100644 --- a/ext/webrtc/utils.c +++ b/ext/webrtc/utils.c @@ -188,6 +188,8 @@ _rtp_caps_from_media (const GstSDPMedia * media) GstCaps *caps; caps = gst_sdp_media_get_caps_from_media (media, pt); + if (!caps) + continue; /* gst_sdp_media_get_caps_from_media() produces caps with name * "application/x-unknown" which will fail intersection with