webrtcbin: Don't assume that non-audio medias are video medias when creating transceivers

And print the unknown media kind in the logs.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2464>
This commit is contained in:
Sebastian Dröge 2021-08-12 15:26:27 +03:00 committed by GStreamer Marge Bot
parent 7a03acc546
commit 01c430fa45

View file

@ -3720,14 +3720,18 @@ _create_answer_task (GstWebRTCBin * webrtc, const GstStructure * options,
if (g_strcmp0 (gst_sdp_media_get_media (offer_media), "audio") == 0)
kind = GST_WEBRTC_KIND_AUDIO;
else
else if (g_strcmp0 (gst_sdp_media_get_media (offer_media),
"video") == 0)
kind = GST_WEBRTC_KIND_VIDEO;
else
GST_LOG_OBJECT (webrtc, "Unknown media kind %s",
GST_STR_NULL (gst_sdp_media_get_media (offer_media)));
trans = _create_webrtc_transceiver (webrtc, answer_dir, i, kind, NULL);
rtp_trans = GST_WEBRTC_RTP_TRANSCEIVER (trans);
GST_LOG_OBJECT (webrtc, "Created new transceiver %" GST_PTR_FORMAT
" for mline %u", trans, i);
" for mline %u with media kind %d", trans, i, kind);
trans_caps = _find_codec_preferences (webrtc, rtp_trans, i, error);
if (*error) {
@ -4891,8 +4895,11 @@ _update_transceivers_from_sdp (GstWebRTCBin * webrtc, SDPSource source,
if (!trans) {
if (g_strcmp0 (gst_sdp_media_get_media (media), "audio") == 0)
kind = GST_WEBRTC_KIND_AUDIO;
else
else if (g_strcmp0 (gst_sdp_media_get_media (media), "video") == 0)
kind = GST_WEBRTC_KIND_VIDEO;
else
GST_LOG_OBJECT (webrtc, "Unknown media kind %s",
GST_STR_NULL (gst_sdp_media_get_media (media)));
trans = _find_transceiver (webrtc, GINT_TO_POINTER (kind),
(FindTransceiverFunc) _find_compatible_unassociated_transceiver);