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