Created
December 21, 2023 18:24
-
-
Save rajneeshksoni/ca2e52f4e10dc92a7ffef1d722654a64 to your computer and use it in GitHub Desktop.
gst-plugins-changes-for-sip
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
diff --git a/ext/webrtc/gstwebrtcbin.c b/ext/webrtc/gstwebrtcbin.c | |
index 6a8f722..4ca44ab 100644 | |
--- a/ext/webrtc/gstwebrtcbin.c | |
+++ b/ext/webrtc/gstwebrtcbin.c | |
@@ -4415,8 +4415,6 @@ _create_answer_task (GstWebRTCBin * webrtc, const GstStructure * options, | |
} | |
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); | |
@@ -4477,7 +4475,7 @@ _create_answer_task (GstWebRTCBin * webrtc, const GstStructure * options, | |
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 = | |
@@ -4997,7 +4995,7 @@ try_match_transceiver_with_fec_decoder (GstWebRTCBin * webrtc, | |
original_pt = | |
GPOINTER_TO_INT (g_object_get_data (G_OBJECT (fecdec), | |
GST_WEBRTC_PAYLOAD_TYPE)); | |
- if (original_pt <= 0) { | |
+ if (original_pt < 0) { | |
GST_WARNING_OBJECT (trans, "failed to match fec decoder with " | |
"transceiver, fec decoder %" GST_PTR_FORMAT " does not contain a " | |
"valid payload type", fecdec); | |
diff --git a/ext/webrtc/webrtcsdp.c b/ext/webrtc/webrtcsdp.c | |
index 1abd4b1..4f0f07a 100644 | |
--- a/ext/webrtc/webrtcsdp.c | |
+++ b/ext/webrtc/webrtcsdp.c | |
@@ -298,11 +298,10 @@ validate_sdp (GstWebRTCSignalingState state, SDPSource source, | |
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)) { | |
@@ -354,40 +353,54 @@ fail: | |
GstWebRTCRTPTransceiverDirection | |
_get_direction_from_media (const GstSDPMedia * media) | |
{ | |
- GstWebRTCRTPTransceiverDirection new_dir = | |
- GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_NONE; | |
+ GstWebRTCRTPTransceiverDirection new_dir; | |
int i; | |
+ gboolean have_direction = FALSE, default_recvonly = FALSE; | |
for (i = 0; i < gst_sdp_media_attributes_len (media); i++) { | |
const GstSDPAttribute *attr = gst_sdp_media_get_attribute (media, i); | |
if (g_strcmp0 (attr->key, "sendonly") == 0) { | |
- if (new_dir != GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_NONE) { | |
+ if (have_direction) { | |
GST_ERROR ("Multiple direction attributes"); | |
return GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_NONE; | |
} | |
new_dir = GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDONLY; | |
+ have_direction = TRUE; | |
} else if (g_strcmp0 (attr->key, "sendrecv") == 0) { | |
- if (new_dir != GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_NONE) { | |
+ if (have_direction) { | |
GST_ERROR ("Multiple direction attributes"); | |
return GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_NONE; | |
} | |
new_dir = GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDRECV; | |
+ have_direction = TRUE; | |
} else if (g_strcmp0 (attr->key, "recvonly") == 0) { | |
- if (new_dir != GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_NONE) { | |
+ if (have_direction) { | |
GST_ERROR ("Multiple direction attributes"); | |
return GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_NONE; | |
} | |
new_dir = GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_RECVONLY; | |
+ have_direction = TRUE; | |
} else if (g_strcmp0 (attr->key, "inactive") == 0) { | |
- if (new_dir != GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_NONE) { | |
+ if (have_direction) { | |
GST_ERROR ("Multiple direction attributes"); | |
return GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_NONE; | |
} | |
new_dir = GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_INACTIVE; | |
+ have_direction = TRUE; | |
+ } else if (g_str_has_prefix (attr->key, "type:") == 0) { | |
+ if (g_strcmp0 (&attr->key[5], "H332") == 0 || | |
+ g_strcmp0 (&attr->key[5], "broadcast") == 0) { | |
+ default_recvonly = TRUE; | |
+ } | |
} | |
} | |
+ if (!have_direction) { | |
+ new_dir = default_recvonly ? GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_RECVONLY : | |
+ GST_WEBRTC_RTP_TRANSCEIVER_DIRECTION_SENDRECV; | |
+ } | |
+ | |
return new_dir; | |
} | |
-- | |
2.32.0 (Apple Git-132) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment