Created
December 22, 2023 05:39
-
-
Save rajneeshksoni/ae096bdae85f7b35395698694acb47cb to your computer and use it in GitHub Desktop.
sip-patch-1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 4b0e4fb2f02a29193779c6aa2482329311b813c3 Mon Sep 17 00:00:00 2001 | |
From: Arun Raghavan <[email protected]> | |
Date: Mon, 9 Jan 2023 21:16:48 -0500 | |
Subject: [PATCH 1/3] webrtcbin: Accept SDP without a=mid lines | |
This should be fine for non-bundle media. | |
--- | |
subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c | 4 +--- | |
subprojects/gst-plugins-bad/ext/webrtc/webrtcsdp.c | 7 +++---- | |
2 files changed, 4 insertions(+), 7 deletions(-) | |
diff --git a/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c b/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c | |
index ad36677c85..2551438d8d 100644 | |
--- a/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c | |
+++ b/subprojects/gst-plugins-bad/ext/webrtc/gstwebrtcbin.c | |
@@ -4464,18 +4464,16 @@ _create_answer_task (GstWebRTCBin * webrtc, const GstStructure * options, | |
if (g_strcmp0 (attr->key, "mid") == 0 | |
|| g_strcmp0 (attr->key, "rtcp-mux") == 0) { | |
gst_sdp_media_add_attribute (media, attr->key, attr->value); | |
/* FIXME: handle anything we want to keep */ | |
} | |
} | |
mid = gst_sdp_media_get_attribute_val (media, "mid"); | |
- /* XXX: not strictly required but a lot of functionality requires a mid */ | |
- g_assert (mid); | |
/* set the a=setup: attribute */ | |
offer_setup = _get_dtls_setup_from_media (offer_media); | |
answer_setup = _intersect_dtls_setup (offer_setup); | |
if (answer_setup == GST_WEBRTC_DTLS_SETUP_NONE) { | |
GST_WARNING_OBJECT (webrtc, "Could not intersect offer setup with " | |
"transceiver direction"); | |
goto rejected; | |
@@ -4526,17 +4524,17 @@ _create_answer_task (GstWebRTCBin * webrtc, const GstStructure * options, | |
gint target_pt = -1; | |
gint original_target_pt = -1; | |
guint target_ssrc = 0; | |
gst_sdp_media_set_proto (media, "UDP/TLS/RTP/SAVPF"); | |
offer_caps = _rtp_caps_from_media (offer_media); | |
if (last_answer && i < gst_sdp_message_medias_len (last_answer) | |
- && (rtp_trans = _find_transceiver_for_mid (webrtc, mid))) { | |
+ && mid && (rtp_trans = _find_transceiver_for_mid (webrtc, mid))) { | |
const GstSDPMedia *last_media = | |
gst_sdp_message_get_media (last_answer, i); | |
const gchar *last_mid = | |
gst_sdp_media_get_attribute_val (last_media, "mid"); | |
GstCaps *current_caps; | |
/* FIXME: assumes no shenanigans with recycling transceivers */ | |
g_assert (g_strcmp0 (mid, last_mid) == 0); | |
diff --git a/subprojects/gst-plugins-bad/ext/webrtc/webrtcsdp.c b/subprojects/gst-plugins-bad/ext/webrtc/webrtcsdp.c | |
index 1abd4b1159..82a7c5fc79 100644 | |
--- a/subprojects/gst-plugins-bad/ext/webrtc/webrtcsdp.c | |
+++ b/subprojects/gst-plugins-bad/ext/webrtc/webrtcsdp.c | |
@@ -293,21 +293,20 @@ validate_sdp (GstWebRTCSignalingState state, SDPSource source, | |
return FALSE;*/ | |
group = gst_sdp_message_get_attribute_val (sdp->sdp, "group"); | |
is_bundle = group && g_str_has_prefix (group, "BUNDLE"); | |
if (is_bundle) | |
group_members = g_strsplit (&group[6], " ", -1); | |
for (i = 0; i < gst_sdp_message_medias_len (sdp->sdp); i++) { | |
const GstSDPMedia *media = gst_sdp_message_get_media (sdp->sdp, i); | |
- const gchar *mid; | |
+ const gchar *mid = NULL; | |
gboolean media_in_bundle = FALSE; | |
- if (!_media_has_mid (media, i, error)) | |
- goto fail; | |
- mid = gst_sdp_media_get_attribute_val (media, "mid"); | |
+ if (is_bundle && _media_has_mid (media, i, error)) | |
+ mid = gst_sdp_media_get_attribute_val (media, "mid"); | |
media_in_bundle = is_bundle | |
&& g_strv_contains ((const gchar **) group_members, mid); | |
if (!_media_get_ice_ufrag (sdp->sdp, i)) { | |
g_set_error (error, GST_WEBRTC_ERROR, GST_WEBRTC_ERROR_SDP_SYNTAX_ERROR, | |
"media %u is missing or contains an empty \'ice-ufrag\' attribute", | |
i); | |
goto fail; | |
} | |
-- | |
2.41.0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment