From 01c430fa45031549ee864cda6c85c29c20ca8364 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Thu, 12 Aug 2021 15:26:27 +0300 Subject: [PATCH] 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: --- ext/webrtc/gstwebrtcbin.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ext/webrtc/gstwebrtcbin.c b/ext/webrtc/gstwebrtcbin.c index f5a83034f7..1fcb6bf863 100644 --- a/ext/webrtc/gstwebrtcbin.c +++ b/ext/webrtc/gstwebrtcbin.c @@ -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); -- 2.34.1