webrtcbin: Reject caps that are not valid for creating an SDP media.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2705>
This commit is contained in:
Sebastian Dröge 2022-06-30 09:09:02 +03:00 committed by Tim-Philipp Müller
parent d8da5358a6
commit 149c8609c6

View file

@ -3087,7 +3087,15 @@ sdp_media_from_transceiver (GstWebRTCBin * webrtc, GstSDPMedia * media,
/* this only looks at the first structure so we loop over the given caps /* this only looks at the first structure so we loop over the given caps
* and add each structure inside it piecemeal */ * and add each structure inside it piecemeal */
gst_sdp_media_set_media_from_caps (format, media); if (gst_sdp_media_set_media_from_caps (format, media) != GST_SDP_OK) {
GST_ERROR_OBJECT (webrtc,
"Failed to build media from caps %" GST_PTR_FORMAT
" for transceiver %" GST_PTR_FORMAT, format, trans);
gst_caps_unref (caps);
gst_caps_unref (format);
gst_structure_free (extmap);
return FALSE;
}
gst_caps_unref (format); gst_caps_unref (format);
} }
@ -4127,7 +4135,13 @@ _create_answer_task (GstWebRTCBin * webrtc, const GstStructure * options,
} }
} }
gst_sdp_media_set_media_from_caps (answer_caps, media); if (gst_sdp_media_set_media_from_caps (answer_caps, media) != GST_SDP_OK) {
GST_WARNING_OBJECT (webrtc,
"Could not build media from caps %" GST_PTR_FORMAT, answer_caps);
gst_clear_caps (&answer_caps);
gst_clear_caps (&offer_caps);
goto rejected;
}
_get_rtx_target_pt_and_ssrc_from_caps (answer_caps, &target_pt, _get_rtx_target_pt_and_ssrc_from_caps (answer_caps, &target_pt,
&target_ssrc); &target_ssrc);